StatusBar - Form Load start Thread to Update Info.

This commit is contained in:
DucDangAnh 2020-07-07 17:13:19 +07:00
parent fbee2526c5
commit a00d77133f
2 changed files with 8 additions and 3 deletions

View File

@ -136,6 +136,7 @@
this.MinimumSize = new System.Drawing.Size(1366, 24); this.MinimumSize = new System.Drawing.Size(1366, 24);
this.Name = "StatusBar"; this.Name = "StatusBar";
this.Size = new System.Drawing.Size(1366, 24); this.Size = new System.Drawing.Size(1366, 24);
this.Load += new System.EventHandler(this.StatusBar_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@ -13,6 +13,7 @@ namespace AIParkingApplication
private string doorAccessControlDeviceIP; private string doorAccessControlDeviceIP;
private TimeSpan updateInterval; private TimeSpan updateInterval;
private const string engineFilePath = @"\engine.bat"; private const string engineFilePath = @"\engine.bat";
private Thread updateInfoThread;
public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval) public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval)
{ {
@ -20,9 +21,7 @@ namespace AIParkingApplication
this.webServerIP = webServerIP; this.webServerIP = webServerIP;
this.doorAccessControlDeviceIP = doorAccessControlDeviceIP; this.doorAccessControlDeviceIP = doorAccessControlDeviceIP;
this.updateInterval = updateInterval; this.updateInterval = updateInterval;
Thread thrStatus = new Thread(new ThreadStart(UpdateStatus)); updateInfoThread = new Thread(new ThreadStart(UpdateStatus)) { IsBackground = true };
thrStatus.IsBackground = true;
thrStatus.Start();
} }
private void UpdateStatus() private void UpdateStatus()
@ -98,6 +97,11 @@ namespace AIParkingApplication
public Color BackColor { get; set; } public Color BackColor { get; set; }
public Color ForeColor { get; set; } public Color ForeColor { get; set; }
} }
private void StatusBar_Load(object sender, EventArgs e)
{
updateInfoThread.Start();
}
} }
} }