From d756d360820763d985d9d6dd74ecc57cbff88b22 Mon Sep 17 00:00:00 2001 From: DucDangAnh Date: Tue, 30 Jun 2020 09:45:36 +0700 Subject: [PATCH] LaneIn - Formload Event: Connect and check door access control connection . --- AIParkingApplication/LaneIn.Designer.cs | 1 + AIParkingApplication/LaneIn.cs | 30 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/AIParkingApplication/LaneIn.Designer.cs b/AIParkingApplication/LaneIn.Designer.cs index cfc59f0..d1de241 100644 --- a/AIParkingApplication/LaneIn.Designer.cs +++ b/AIParkingApplication/LaneIn.Designer.cs @@ -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); diff --git a/AIParkingApplication/LaneIn.cs b/AIParkingApplication/LaneIn.cs index 3027e96..64ba662 100644 --- a/AIParkingApplication/LaneIn.cs +++ b/AIParkingApplication/LaneIn.cs @@ -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(); + } } }