diff --git a/AIParkingApplication/AIParkingApplicationForm.Designer.cs b/AIParkingApplication/AIParkingApplicationForm.Designer.cs index 7738f8c..e518972 100644 --- a/AIParkingApplication/AIParkingApplicationForm.Designer.cs +++ b/AIParkingApplication/AIParkingApplicationForm.Designer.cs @@ -62,28 +62,28 @@ // toolStripMenuItemSwitchLaneInIn // this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn"; - this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào"; this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click); // // toolStripMenuItemSwitchLaneInOut // this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut"; - this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra"; this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click); // // toolStripMenuItemSwitchLaneOutOut // this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut"; - this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra"; this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click); // // toolStripMenuItemSwitchLaneOutIn // this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn"; - this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào"; this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click); // @@ -100,6 +100,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "AIParking - Phần mềm quản lý bãi đỗ xe"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AIParkingApplicationForm_FormClosing); + this.Load += new System.EventHandler(this.AIParkingApplicationForm_Load); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.ResumeLayout(false); diff --git a/AIParkingApplication/AIParkingApplicationForm.cs b/AIParkingApplication/AIParkingApplicationForm.cs index 722d6d3..95c21a7 100644 --- a/AIParkingApplication/AIParkingApplicationForm.cs +++ b/AIParkingApplication/AIParkingApplicationForm.cs @@ -27,7 +27,13 @@ namespace AIParkingApplication this.configOnWeb = configOnWeb; ReadAccessControlDeviceIPConfiguration(); + if (string.IsNullOrEmpty(doorAccessControlDeviceIP)) + { + MessageBox.Show("Kiểm tra lại cấu hình IP thiết bị mở cửa! (C3200)", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); + Application.Exit(); + } + c3Device = new C3DeviceController(doorAccessControlDeviceIP); sidebar = new Sidebar(apiController) { Location = new Point(0, 0) @@ -51,7 +57,7 @@ namespace AIParkingApplication return; } - InitAllLanes(); + } private void InitAllLanes() @@ -200,10 +206,8 @@ namespace AIParkingApplication } catch (Exception ex) { - MessageBox.Show("Kiểm tra lại cấu hình IP thiết bị mở cửa! (C3200)"); Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}"); - Application.Exit(); - return; + doorAccessControlDeviceIP = string.Empty; } } @@ -211,5 +215,10 @@ namespace AIParkingApplication { Application.Exit(); } + + private void AIParkingApplicationForm_Load(object sender, EventArgs e) + { + InitAllLanes(); + } } }