Statistic - use ApiController instead baseAddress
This commit is contained in:
parent
d1128f34c2
commit
ede593da17
|
@ -11,6 +11,8 @@ namespace AIParkingApplication
|
||||||
private LaneIn laneIn;
|
private LaneIn laneIn;
|
||||||
private LaneOut laneOut;
|
private LaneOut laneOut;
|
||||||
private StatusBar statusBar;
|
private StatusBar statusBar;
|
||||||
|
private Statistic statistic;
|
||||||
|
|
||||||
|
|
||||||
public AIParkingApplicationForm()
|
public AIParkingApplicationForm()
|
||||||
{
|
{
|
||||||
|
@ -29,6 +31,8 @@ namespace AIParkingApplication
|
||||||
statusBar.Location = new System.Drawing.Point(0, 692);
|
statusBar.Location = new System.Drawing.Point(0, 692);
|
||||||
statusBar.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
|
statusBar.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
|
||||||
Controls.Add(statusBar);
|
Controls.Add(statusBar);
|
||||||
|
|
||||||
|
statistic = new Statistic(apiController, TimeSpan.FromMinutes(10));
|
||||||
StartLanes();
|
StartLanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace AIParkingApplication
|
||||||
private readonly Thread thrStatistics;
|
private readonly Thread thrStatistics;
|
||||||
private readonly TimeSpan updateInterval;
|
private readonly TimeSpan updateInterval;
|
||||||
private ParkInfo parkInfo;
|
private ParkInfo parkInfo;
|
||||||
private string baseAddress;
|
private ApiController apiController;
|
||||||
|
|
||||||
private Label lblLoaiXe;
|
private Label lblLoaiXe;
|
||||||
private Label lblXeMay;
|
private Label lblXeMay;
|
||||||
|
@ -19,10 +19,10 @@ namespace AIParkingApplication
|
||||||
private Label lblSoLuongXeMay;
|
private Label lblSoLuongXeMay;
|
||||||
private Label lblSoLuongOto;
|
private Label lblSoLuongOto;
|
||||||
|
|
||||||
public Statistic(string baseAddress, TimeSpan updateInterval)
|
public Statistic(ApiController apiController, TimeSpan updateInterval)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.baseAddress = baseAddress;
|
this.apiController = apiController;
|
||||||
this.updateInterval = updateInterval;
|
this.updateInterval = updateInterval;
|
||||||
thrStatistics = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true };
|
thrStatistics = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true };
|
||||||
thrStatistics.Start();
|
thrStatistics.Start();
|
||||||
|
@ -40,7 +40,6 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
async void GetDataFromServer()
|
async void GetDataFromServer()
|
||||||
{
|
{
|
||||||
ApiController apiController = new ApiController(this.baseAddress);
|
|
||||||
parkInfo = await apiController.GetStatisticInfo();
|
parkInfo = await apiController.GetStatisticInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user