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(); + } } }