Check Radio Button Checked

This commit is contained in:
DucDangAnh 2020-06-20 19:27:07 +07:00
parent 469086cfa2
commit 2aa346ec64

View File

@ -231,7 +231,9 @@ namespace BITable
private void btnFaceAndPaper_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(1, true, true);
}
@ -239,9 +241,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked & !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(1, true, true);
}
else
@ -249,6 +255,7 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private Bitmap ParseImageFromBase64(string imageBase64)
{
@ -260,27 +267,11 @@ namespace BITable
}
}
public class Base64Image
{
[JsonProperty("base64")]
public string Base64 { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
public class RequestResult
{
[JsonProperty("data")]
public Base64Image[] Data { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
}
private void btnFace_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(2, true, false);
}
@ -288,9 +279,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked & !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(2, true, false);
}
else
@ -298,10 +293,13 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private void btnFontPaper_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(3, false, true);
}
@ -309,9 +307,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked && !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(3, false, true);
}
else
@ -319,10 +321,13 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private void btnBehindPaper_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(4, false, true);
}
@ -330,9 +335,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked & !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(4, false, true);
}
else
@ -340,10 +349,13 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private void btnFaceCamera_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(5, true, false);
}
@ -351,9 +363,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked & !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(5, true, false);
}
else
@ -361,10 +377,13 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private void btnPaperCamera_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(6, false, true);
}
@ -372,9 +391,13 @@ namespace BITable
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
}
}
if (radioButtonIpApi.Checked & !string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
if (radioButtonIpApi.Checked)
{
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(6, false, true);
}
else
@ -382,6 +405,7 @@ namespace BITable
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
private void DoRequestAPI(int option, bool isClearFaceImage, bool isClearIDCard)
{
@ -452,7 +476,7 @@ namespace BITable
{
lblStatusSign.Invoke(new Action(() =>
{
lblStatusSign.BackColor = Color.Green;
lblStatusSign.BackColor = Color.Blue;
}));
}
}
@ -482,10 +506,9 @@ namespace BITable
}
}
}
catch (Exception ex)
catch (Exception)
{
MessageBox.Show("Không có kết nối internet!");
Console.WriteLine($"SendEngineRequest : {ex.Message}");
}
}));
}
@ -497,6 +520,23 @@ namespace BITable
[JsonProperty("error")]
public string Error { get; set; }
}
public class Base64Image
{
[JsonProperty("base64")]
public string Base64 { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
public class RequestResult
{
[JsonProperty("data")]
public Base64Image[] Data { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
}
}
}