From fbee2526c530aa050393631a9b50544f02ec18b9 Mon Sep 17 00:00:00 2001 From: DucDangAnh Date: Tue, 7 Jul 2020 17:09:47 +0700 Subject: [PATCH] Statistic - Fix bugs. --- AIParkingApplication/Statistic.Designer.cs | 1 + AIParkingApplication/Statistic.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/AIParkingApplication/Statistic.Designer.cs b/AIParkingApplication/Statistic.Designer.cs index 65d3e25..754037a 100644 --- a/AIParkingApplication/Statistic.Designer.cs +++ b/AIParkingApplication/Statistic.Designer.cs @@ -256,6 +256,7 @@ this.Controls.Add(this.grbVehicleStatistics); this.Name = "Statistic"; this.Size = new System.Drawing.Size(192, 292); + this.Load += new System.EventHandler(this.Statistic_Load); this.grbVehicleStatistics.ResumeLayout(false); this.tlpStatisticTable.ResumeLayout(false); this.tlpStatisticTable.PerformLayout(); diff --git a/AIParkingApplication/Statistic.cs b/AIParkingApplication/Statistic.cs index d7b0985..54a4478 100644 --- a/AIParkingApplication/Statistic.cs +++ b/AIParkingApplication/Statistic.cs @@ -17,7 +17,6 @@ namespace AIParkingApplication this.apiController = apiController; this.updateInterval = updateInterval; statisticsThread = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true }; - statisticsThread.Start(); } private void GetStatistic() @@ -55,5 +54,10 @@ namespace AIParkingApplication [JsonProperty("total_out")] public string TotalOut { get; set; } } + + private void Statistic_Load(object sender, EventArgs e) + { + statisticsThread.Start(); + } } }