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,22 +231,29 @@ namespace BITable
private void btnFaceAndPaper_Click(object sender, EventArgs e)
{
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected)
if (radioButtonBluetooth.Checked)
{
DoRequest(1, true, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(1, true, true);
}
else
{
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)
{
DoRequestAPI(1, true, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(1, true, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
@ -260,126 +267,143 @@ 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)
{
DoRequest(2, true, false);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(2, true, false);
}
else
{
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)
{
DoRequestAPI(2, true, false);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(2, true, false);
}
else
{
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)
{
DoRequest(3, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(3, false, true);
}
else
{
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)
{
DoRequestAPI(3, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(3, false, true);
}
else
{
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)
{
DoRequest(4, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(4, false, true);
}
else
{
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)
{
DoRequestAPI(4, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(4, false, true);
}
else
{
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)
{
DoRequest(5, true, false);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(5, true, false);
}
else
{
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)
{
DoRequestAPI(5, true, false);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(5, true, false);
}
else
{
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)
{
DoRequest(6, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!");
if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
{
DoRequest(6, false, true);
}
else
{
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)
{
DoRequestAPI(6, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
{
DoRequestAPI(6, false, true);
}
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
}
}
@ -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; }
}
}
}