diff --git a/AIParkingApplication/LaneOut.Designer.cs b/AIParkingApplication/LaneOut.Designer.cs index b00cf28..eb45171 100644 --- a/AIParkingApplication/LaneOut.Designer.cs +++ b/AIParkingApplication/LaneOut.Designer.cs @@ -267,6 +267,7 @@ this.Controls.Add(this.grbPlateRefernce); this.Name = "LaneOut"; this.Size = new System.Drawing.Size(680, 692); + this.Load += new System.EventHandler(this.LaneOut_Load); this.grbPlateRefernce.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImageIn)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImageIn)).EndInit(); diff --git a/AIParkingApplication/LaneOut.cs b/AIParkingApplication/LaneOut.cs index 4a2c911..26075e7 100644 --- a/AIParkingApplication/LaneOut.cs +++ b/AIParkingApplication/LaneOut.cs @@ -43,15 +43,7 @@ namespace AIParkingApplication plateCamera = new Camera(plateStream); this.apiController = apiController; this.doorControlAccess = doorControlAccess; - this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived; printer = new Printer(); - - plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived; - plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed; - - overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived; - overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed; - plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate); } @@ -244,9 +236,9 @@ namespace AIParkingApplication private void ConnectToDoorAccessControl() { - if (!this.doorControlAccess.Connect().HasError) + if (!doorControlAccess.Connect().HasError) { - _ = this.doorControlAccess.GetLogToReceiveNewCard(); + _ = doorControlAccess.GetLogToReceiveNewCard(); } else { @@ -258,5 +250,15 @@ namespace AIParkingApplication { ConnectToDoorAccessControl(); } + + private void LaneOut_Load(object sender, EventArgs e) + { + doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived; + plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived; + plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed; + + overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived; + overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed; + } } }