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) private void btnFaceAndPaper_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(1, true, true); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(1, true, true);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(1, true, true);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
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) private void btnFace_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(2, true, false); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(2, true, false);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(2, true, false);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
} }
} }
private void btnFontPaper_Click(object sender, EventArgs e) private void btnFontPaper_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(3, false, true); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(3, false, true);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(3, false, true);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
} }
} }
private void btnBehindPaper_Click(object sender, EventArgs e) private void btnBehindPaper_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(4, false, true); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(4, false, true);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(4, false, true);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
} }
} }
private void btnFaceCamera_Click(object sender, EventArgs e) private void btnFaceCamera_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(5, true, false); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(5, true, false);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(5, true, false);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
else
{
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!");
}
} }
} }
private void btnPaperCamera_Click(object sender, EventArgs e) private void btnPaperCamera_Click(object sender, EventArgs e)
{ {
if (radioButtonBluetooth.Checked && !string.IsNullOrEmpty(currentBluetoothDeviceName) && client.Connected) if (radioButtonBluetooth.Checked)
{ {
DoRequest(6, false, true); if (!string.IsNullOrEmpty(currentBluetoothDeviceName))
} {
else DoRequest(6, false, true);
{ }
MessageBox.Show("Chưa kết nối tới thiết bị BI Table qua Bluetooth!"); 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); if (!string.IsNullOrEmpty(txtIPAddress.Text) && !string.IsNullOrEmpty(deviceUrl))
} {
else
{ DoRequestAPI(6, false, true);
MessageBox.Show("Chưa kết nối tới thiết bị BI Table!"); }
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.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!"); MessageBox.Show("Không có kết nối internet!");
Console.WriteLine($"SendEngineRequest : {ex.Message}");
} }
})); }));
} }
@ -497,6 +520,23 @@ namespace BITable
[JsonProperty("error")] [JsonProperty("error")]
public string Error { get; set; } 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; }
}
} }
} }