LaneIn - use UpdateLabel.

This commit is contained in:
DucDangAnh 2020-06-30 10:52:30 +07:00
parent 9668f8f3ac
commit 562cccc7d5

View File

@ -85,29 +85,17 @@ namespace AIParkingApplication
} }
else else
{ {
lblStatusInfo.Invoke(new Action(() => lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ";
}));
} }
} }
else else
{ {
lblStatusInfo.Invoke(new Action(() => lblStatusInfo.UpdateLabel("THẺ ĐÃ ĐƯỢC SỬ DỤNG", Color.Red);
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "THẺ ĐÃ ĐƯỢC SỬ DỤNG";
}));
} }
} }
else else
{ {
lblStatusInfo.Invoke(new Action(() => lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
{
lblStatusInfo.BackColor = Color.Purple;
lblStatusInfo.Text = "THẺ KHÔNG HỢP LỆ";
}));
} }
} }
@ -131,11 +119,7 @@ namespace AIParkingApplication
{ {
if (c3Device.OpenDoor(doorId).HasError) if (c3Device.OpenDoor(doorId).HasError)
{ {
lblStatusInfo.Invoke(new Action(() => lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "KHÔNG THỂ MỞ CỬA";
}));
} }
} }
@ -181,31 +165,11 @@ namespace AIParkingApplication
private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTime) private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTime)
{ {
lblCardNumber.Invoke(new Action(() => lblCardNumber.UpdateLabel($"Số thẻ: {cardNumber}", lblCardNumber.BackColor);
{ lblPlateString.UpdateLabel($"Biển số: {plateString}", lblPlateString.BackColor);
lblCardNumber.Text = $"Số thẻ: {cardNumber}"; lblCardType.UpdateLabel($"Loại thẻ: {cardType}", lblCardType.BackColor);
})); lblCardTime.UpdateLabel($"Thời gian: {cardTime}", lblCardTime.BackColor);
lblStatusInfo.UpdateLabel(string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} VÀO", string.IsNullOrEmpty(plateString) ? Color.Red : Color.Green);
lblPlateString.Invoke(new Action(() =>
{
lblPlateString.Text = $"Biển số: {plateString}";
}));
lblCardType.Invoke(new Action(() =>
{
lblCardType.Text = $"Loại thẻ: {cardType}";
}));
lblCardTime.Invoke(new Action(() =>
{
lblCardTime.Text = $"Thời gian: {cardTime}";
}));
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.Text = string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} VÀO";
lblStatusInfo.BackColor = string.IsNullOrEmpty(plateString) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
}));
} }
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame) private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)
@ -240,11 +204,7 @@ namespace AIParkingApplication
} }
else else
{ {
lblStatusInfo.Invoke(new Action(() => lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI TỚI C3200", Color.Purple);
{
lblStatusInfo.BackColor = Color.Purple;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI TỚI C3200";
}));
} }
} }
@ -253,4 +213,4 @@ namespace AIParkingApplication
ConnectToDoorAccessControl(); ConnectToDoorAccessControl();
} }
} }
} }