StatusBar - Remove updateInterval

This commit is contained in:
DucDangAnh 2020-07-13 11:04:48 +07:00
parent 50301189d8
commit 728f65cd90
2 changed files with 4 additions and 6 deletions

View File

@ -40,7 +40,7 @@ namespace AIParkingApplication
}; };
Controls.Add(sidebar); Controls.Add(sidebar);
statusBar = new StatusBar("192.168.1.122", doorAccessControlDeviceIP, TimeSpan.FromSeconds(1)) statusBar = new StatusBar("192.168.1.122", doorAccessControlDeviceIP)
{ {
Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26), Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26),
Anchor = AnchorStyles.Bottom | AnchorStyles.Left Anchor = AnchorStyles.Bottom | AnchorStyles.Left

View File

@ -11,17 +11,15 @@ namespace AIParkingApplication
{ {
private string webServerIP; private string webServerIP;
private string doorAccessControlDeviceIP; private string doorAccessControlDeviceIP;
private TimeSpan updateInterval;
private const string engineFilePath = @"\engine.bat"; private const string engineFilePath = @"\engine.bat";
private Thread updateInfoThread; private Thread updateInfoThread;
public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval) public StatusBar(string webServerIP, string doorAccessControlDeviceIP)
{ {
InitializeComponent(); InitializeComponent();
this.webServerIP = webServerIP; this.webServerIP = webServerIP;
this.doorAccessControlDeviceIP = doorAccessControlDeviceIP; this.doorAccessControlDeviceIP = doorAccessControlDeviceIP;
this.updateInterval = updateInterval; updateInfoThread = new Thread(UpdateStatus) { IsBackground = true };
updateInfoThread = new Thread(new ThreadStart(UpdateStatus)) { IsBackground = true };
} }
private void UpdateStatus() private void UpdateStatus()
@ -56,7 +54,7 @@ namespace AIParkingApplication
lblEngineStatus.UpdateLabel("ĐANG HOẠT ĐỘNG", Color.Green); lblEngineStatus.UpdateLabel("ĐANG HOẠT ĐỘNG", Color.Green);
} }
} }
Thread.Sleep(updateInterval); Thread.Sleep(TimeSpan.FromSeconds(1));
} }
} }