diff --git a/AIParkingApplication/AIParkingApplicationForm.cs b/AIParkingApplication/AIParkingApplicationForm.cs index e586c93..04c22d4 100644 --- a/AIParkingApplication/AIParkingApplicationForm.cs +++ b/AIParkingApplication/AIParkingApplicationForm.cs @@ -58,9 +58,9 @@ namespace AIParkingApplication { 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); return; } @@ -100,8 +100,6 @@ namespace AIParkingApplication laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height); laneOut34.Show(); laneOut34.Start(); - - toolStripMenuItemSwitchLaneInOut.DisableSelected(); } private void UpdateLaneInIn() @@ -115,8 +113,6 @@ namespace AIParkingApplication laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height); laneIn56.Show(); laneIn56.Start(); - - toolStripMenuItemSwitchLaneInIn.DisableSelected(); } private void UpdateLaneOutIn() @@ -130,8 +126,6 @@ namespace AIParkingApplication laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height); laneIn56.Show(); laneIn56.Start(); - - toolStripMenuItemSwitchLaneOutIn.DisableSelected(); } private void UpdateLaneOutOut() @@ -145,8 +139,6 @@ namespace AIParkingApplication laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height); laneOut34.Show(); laneOut34.Start(); - - toolStripMenuItemSwitchLaneOutOut.DisableSelected(); } private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e) @@ -235,21 +227,25 @@ namespace AIParkingApplication if (lane0 == "in" && lane1 == "in") { UpdateLaneInIn(); + toolStripMenuItemSwitchLaneInIn.DisableSelected(); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-IN"); } if (lane0 == "in" && lane1 == "out") { UpdateLaneInOut(); + toolStripMenuItemSwitchLaneInOut.DisableSelected(); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-OUT"); } if (lane0 == "out" && lane1 == "in") { UpdateLaneOutIn(); + toolStripMenuItemSwitchLaneOutIn.DisableSelected(); applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-IN"); } if (lane0 == "out" && lane1 == "out") { UpdateLaneOutOut(); + toolStripMenuItemSwitchLaneOutOut.DisableSelected(); 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"); UpdateLaneInOut(); + toolStripMenuItemSwitchLaneInOut.DisableSelected(); 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"); UpdateLaneInOut(); + toolStripMenuItemSwitchLaneInOut.DisableSelected(); 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}"); }