Handle một lỗi Thread chạy trước khi Control được tạo dẫn đến lỗi
This commit is contained in:
parent
30f5f14ee7
commit
5d7dcd63da
|
@ -22,6 +22,8 @@ namespace AIParkingApplication
|
||||||
private void UpdateStatus()
|
private void UpdateStatus()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
{
|
||||||
|
if (IsHandleCreated)
|
||||||
{
|
{
|
||||||
lblDateTime.Invoke(new Action(() =>
|
lblDateTime.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
|
@ -43,6 +45,7 @@ namespace AIParkingApplication
|
||||||
lblPingTimeServer.BackColor = pingResult.BackColor;
|
lblPingTimeServer.BackColor = pingResult.BackColor;
|
||||||
lblPingTimeServer.ForeColor = pingResult.ForceColor;
|
lblPingTimeServer.ForeColor = pingResult.ForceColor;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user