Lấy API Url thông qua tham số của Constructor
This commit is contained in:
parent
b877a1493e
commit
444b58721f
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user