AIParkingApplicationForm - Remove Redundant code.

This commit is contained in:
DucDangAnh 2020-07-14 17:06:06 +07:00
parent ee590211f8
commit b020ca2a73

View File

@ -58,9 +58,9 @@ namespace AIParkingApplication
{ {
engineApiController = new EngineApiController($"http://{this.configOnWeb.APIPath.ApiPlateRecognize.IP}:{this.configOnWeb.APIPath.ApiPlateRecognize.Port}"); engineApiController = new EngineApiController($"http://{this.configOnWeb.APIPath.ApiPlateRecognize.IP}:{this.configOnWeb.APIPath.ApiPlateRecognize.Port}");
} }
catch (Exception) catch (Exception ex)
{ {
applicationLogger.Log(LogLevel.Error, "Cấu hình URL của Engine nhận diện biển số lỗi!"); applicationLogger.Log(LogLevel.Error, $"Cấu hình URL của Engine nhận diện biển số lỗi. exMessage: {ex.Message}");
MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
@ -100,8 +100,6 @@ namespace AIParkingApplication
laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height); laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
laneOut34.Show(); laneOut34.Show();
laneOut34.Start(); laneOut34.Start();
toolStripMenuItemSwitchLaneInOut.DisableSelected();
} }
private void UpdateLaneInIn() private void UpdateLaneInIn()
@ -115,8 +113,6 @@ namespace AIParkingApplication
laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height); laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
laneIn56.Show(); laneIn56.Show();
laneIn56.Start(); laneIn56.Start();
toolStripMenuItemSwitchLaneInIn.DisableSelected();
} }
private void UpdateLaneOutIn() private void UpdateLaneOutIn()
@ -130,8 +126,6 @@ namespace AIParkingApplication
laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height); laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
laneIn56.Show(); laneIn56.Show();
laneIn56.Start(); laneIn56.Start();
toolStripMenuItemSwitchLaneOutIn.DisableSelected();
} }
private void UpdateLaneOutOut() private void UpdateLaneOutOut()
@ -145,8 +139,6 @@ namespace AIParkingApplication
laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height); laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
laneOut34.Show(); laneOut34.Show();
laneOut34.Start(); laneOut34.Start();
toolStripMenuItemSwitchLaneOutOut.DisableSelected();
} }
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e) private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
@ -235,21 +227,25 @@ namespace AIParkingApplication
if (lane0 == "in" && lane1 == "in") if (lane0 == "in" && lane1 == "in")
{ {
UpdateLaneInIn(); UpdateLaneInIn();
toolStripMenuItemSwitchLaneInIn.DisableSelected();
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-IN"); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-IN");
} }
if (lane0 == "in" && lane1 == "out") if (lane0 == "in" && lane1 == "out")
{ {
UpdateLaneInOut(); UpdateLaneInOut();
toolStripMenuItemSwitchLaneInOut.DisableSelected();
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-OUT"); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-OUT");
} }
if (lane0 == "out" && lane1 == "in") if (lane0 == "out" && lane1 == "in")
{ {
UpdateLaneOutIn(); UpdateLaneOutIn();
toolStripMenuItemSwitchLaneOutIn.DisableSelected();
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-IN"); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-IN");
} }
if (lane0 == "out" && lane1 == "out") if (lane0 == "out" && lane1 == "out")
{ {
UpdateLaneOutOut(); UpdateLaneOutOut();
toolStripMenuItemSwitchLaneOutOut.DisableSelected();
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-OUT"); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-OUT");
} }
} }
@ -257,6 +253,7 @@ namespace AIParkingApplication
{ {
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT"); Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
UpdateLaneInOut(); UpdateLaneInOut();
toolStripMenuItemSwitchLaneInOut.DisableSelected();
applicationLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT"); applicationLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT");
} }
} }
@ -265,6 +262,7 @@ namespace AIParkingApplication
{ {
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT"); Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
UpdateLaneInOut(); UpdateLaneInOut();
toolStripMenuItemSwitchLaneInOut.DisableSelected();
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}"); Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
applicationLogger.Log(LogLevel.Error, $"Đọc config làn lỗi khi khởi động app!\texMessage: {ex.Message}"); applicationLogger.Log(LogLevel.Error, $"Đọc config làn lỗi khi khởi động app!\texMessage: {ex.Message}");
} }