diff --git a/AIParkingApplication/Statistic.cs b/AIParkingApplication/Statistic.cs index ac1a984..fcd7289 100644 --- a/AIParkingApplication/Statistic.cs +++ b/AIParkingApplication/Statistic.cs @@ -1,10 +1,5 @@ using System; -using System.Text; using System.Windows.Forms; -using System.IO; -using System.Net; -using System.Web.Script.Serialization; -using System.Diagnostics.SymbolStore; using System.Threading; using Newtonsoft.Json; using System.Net.Http; @@ -13,7 +8,7 @@ namespace AIParkingApplication { public partial class Statistic : UserControl { - private readonly HttpClient client = new HttpClient { BaseAddress = new Uri("http://192.168.1.123:80/"), Timeout = TimeSpan.FromMilliseconds(5000) }; + private readonly HttpClient client; Label lblLoaiXe; Label lblXeMay; @@ -22,10 +17,11 @@ namespace AIParkingApplication Label lblSoLuongXeMay; Label lblSoLuongOto; - public Statistic() + public Statistic(string apiUrl) { InitializeComponent(); Thread thrStatistics = new Thread(new ThreadStart(GetStatistic)); + client = new HttpClient { BaseAddress = new Uri(apiUrl), Timeout = TimeSpan.FromMilliseconds(5000) }; thrStatistics.IsBackground = true; thrStatistics.Start(); }