From 444b58721fe123675348dff563cd244f1379ef27 Mon Sep 17 00:00:00 2001 From: Le Chau Date: Thu, 25 Jun 2020 09:46:30 +0700 Subject: [PATCH] =?UTF-8?q?L=E1=BA=A5y=20API=20Url=20th=C3=B4ng=20qua=20th?= =?UTF-8?q?am=20s=E1=BB=91=20c=E1=BB=A7a=20Constructor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AIParkingApplication/Statistic.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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(); }