Compare commits
No commits in common. "56e6ef249dbb6dd9b36054af98dd3b36f01e38eb" and "e006ea75e4d5e527f96cb6e7e55b1947b383d9d5" have entirely different histories.
56e6ef249d
...
e006ea75e4
|
@ -23,16 +23,12 @@ namespace AIParkingApplication
|
|||
InitializeComponent();
|
||||
this.apiController = apiController;
|
||||
this.configOnWeb = configOnWeb;
|
||||
c3Device = new C3DeviceController("192.168.1.200");
|
||||
|
||||
sidebar = new Sidebar(apiController);
|
||||
sidebar.Location = new Point(0, 0);
|
||||
Controls.Add(sidebar);
|
||||
|
||||
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
||||
statusBar.Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26);
|
||||
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
Controls.Add(statusBar);
|
||||
c3Device = new C3DeviceController("192.168.1.200");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -44,6 +40,11 @@ namespace AIParkingApplication
|
|||
return;
|
||||
}
|
||||
|
||||
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
||||
statusBar.Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26);
|
||||
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
Controls.Add(statusBar);
|
||||
|
||||
InitAllLanes();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,15 +13,17 @@ namespace AIParkingApplication
|
|||
private const int MAX_REQUEST = 3;
|
||||
private HttpClient httpClient;
|
||||
private bool isHttpClientDisposabled;
|
||||
private int numberOfRetry;
|
||||
|
||||
public ApiController(string baseAddress, int numberOfRetry = 5)
|
||||
{
|
||||
httpClient = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(baseAddress),
|
||||
Timeout = TimeSpan.FromSeconds(1)
|
||||
Timeout = TimeSpan.FromSeconds(5)
|
||||
};
|
||||
isHttpClientDisposabled = false;
|
||||
this.numberOfRetry = numberOfRetry;
|
||||
}
|
||||
|
||||
~ApiController()
|
||||
|
@ -89,7 +91,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
response = await httpClient.PostAsJsonAsync("/api/check-card", request);
|
||||
requestCounter += 1;
|
||||
await Task.Delay(100);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
||||
|
||||
|
@ -100,7 +102,7 @@ namespace AIParkingApplication
|
|||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||
return null;
|
||||
return new CardInformation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +135,9 @@ namespace AIParkingApplication
|
|||
{
|
||||
response = await httpClient.PostAsJsonAsync("/api/save-logs", request);
|
||||
requestCounter += 1;
|
||||
await Task.Delay(100);
|
||||
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
||||
response.EnsureSuccessStatusCode();
|
||||
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
||||
return saveLogRespone;
|
||||
|
|
|
@ -56,11 +56,6 @@ namespace AIParkingApplication
|
|||
}
|
||||
ClearPlateAndOverviewImage();
|
||||
var cardInfoResult = await apiController.GetCardInformation(cardNumber);
|
||||
if (cardInfoResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
||||
return;
|
||||
}
|
||||
if (!cardInfoResult.IsValid)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||
|
|
|
@ -59,11 +59,6 @@ namespace AIParkingApplication
|
|||
ClearPlateAndOverviewImage();
|
||||
ClearPlateAndOverviewImageIn();
|
||||
var cardInfoResult = await apiController.GetCardInformation(cardNumber);
|
||||
if (cardInfoResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
||||
return;
|
||||
}
|
||||
if (!cardInfoResult.IsValid)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||
|
|
Loading…
Reference in New Issue
Block a user