diff --git a/AIParkingApplication/StatusBar.Designer.cs b/AIParkingApplication/StatusBar.Designer.cs index f7797f4..fc4f384 100644 --- a/AIParkingApplication/StatusBar.Designer.cs +++ b/AIParkingApplication/StatusBar.Designer.cs @@ -136,6 +136,7 @@ this.MinimumSize = new System.Drawing.Size(1366, 24); this.Name = "StatusBar"; this.Size = new System.Drawing.Size(1366, 24); + this.Load += new System.EventHandler(this.StatusBar_Load); this.ResumeLayout(false); } diff --git a/AIParkingApplication/StatusBar.cs b/AIParkingApplication/StatusBar.cs index cb6588b..2fcf364 100644 --- a/AIParkingApplication/StatusBar.cs +++ b/AIParkingApplication/StatusBar.cs @@ -13,6 +13,7 @@ namespace AIParkingApplication private string doorAccessControlDeviceIP; private TimeSpan updateInterval; private const string engineFilePath = @"\engine.bat"; + private Thread updateInfoThread; public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval) { @@ -20,9 +21,7 @@ namespace AIParkingApplication this.webServerIP = webServerIP; this.doorAccessControlDeviceIP = doorAccessControlDeviceIP; this.updateInterval = updateInterval; - Thread thrStatus = new Thread(new ThreadStart(UpdateStatus)); - thrStatus.IsBackground = true; - thrStatus.Start(); + updateInfoThread = new Thread(new ThreadStart(UpdateStatus)) { IsBackground = true }; } private void UpdateStatus() @@ -98,6 +97,11 @@ namespace AIParkingApplication public Color BackColor { get; set; } public Color ForeColor { get; set; } } + + private void StatusBar_Load(object sender, EventArgs e) + { + updateInfoThread.Start(); + } } }