LaneIn - Formload Event: Connect and check door access control connection .

This commit is contained in:
DucDangAnh 2020-06-30 09:45:36 +07:00
parent 1eee458212
commit d756d36082
2 changed files with 24 additions and 7 deletions

View File

@ -201,6 +201,7 @@
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "LaneIn";
this.Size = new System.Drawing.Size(442, 692);
this.Load += new System.EventHandler(this.LaneIn_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).EndInit();
this.grbPlateCamera.ResumeLayout(false);

View File

@ -51,11 +51,6 @@ namespace AIParkingApplication
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
if (!this.c3Device.Connect().HasError)
{
_ = this.c3Device.GetLogToReceiveNewCard();
}
}
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
@ -70,7 +65,7 @@ namespace AIParkingApplication
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
var plateVideoFrame = plateCamera.CurrentFrame;
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
pictureBoxPlateImage.Invoke(new Action(() =>
{
@ -164,7 +159,7 @@ namespace AIParkingApplication
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Red;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI TỚI THIẾT BỊ MỞ CỬA";
lblStatusInfo.Text = "KHÔNG THỂ MỞ CỬA";
}));
}
}
@ -269,5 +264,26 @@ namespace AIParkingApplication
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
}
}
private void ConnectToDoorAccessControl()
{
if (!this.c3Device.Connect().HasError)
{
_ = this.c3Device.GetLogToReceiveNewCard();
}
else
{
lblStatusInfo.Invoke(new Action(() =>
{
lblStatusInfo.BackColor = Color.Purple;
lblStatusInfo.Text = "KHÔNG THỂ KẾT NỐI TỚI C3200";
}));
}
}
private void LaneIn_Load(object sender, EventArgs e)
{
ConnectToDoorAccessControl();
}
}
}