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
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ";
}));
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
}
}
else
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "THẺ ĐÃ ĐƯỢC SỬ DỤNG";
}));
lblStatusInfo.UpdateLabel("THẺ ĐÃ ĐƯỢC SỬ DỤNG", Color.Red);
}
}
else
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Purple;
lblStatusInfo.Text = "THẺ KHÔNG HỢP LỆ";
}));
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
}
}
@ -131,11 +119,7 @@ namespace AIParkingApplication
{
if (c3Device.OpenDoor(doorId).HasError)
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "KHÔNG THỂ MỞ CỬA";
}));
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
}
}
@ -181,31 +165,11 @@ namespace AIParkingApplication
private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTime)
{
lblCardNumber.Invoke(new Action(() =>
{
lblCardNumber.Text = $"Số thẻ: {cardNumber}";
}));
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;
}));
lblCardNumber.UpdateLabel($"Số thẻ: {cardNumber}", lblCardNumber.BackColor);
lblPlateString.UpdateLabel($"Biển số: {plateString}", lblPlateString.BackColor);
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);
}
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)
@ -240,11 +204,7 @@ namespace AIParkingApplication
}
else
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Purple;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI TỚI C3200";
}));
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI TỚI C3200", Color.Purple);
}
}
@ -253,4 +213,4 @@ namespace AIParkingApplication
ConnectToDoorAccessControl();
}
}
}
}