Compare commits
5 Commits
d9c7da60b5
...
0cc0400b05
Author | SHA1 | Date | |
---|---|---|---|
0cc0400b05 | |||
b46d79e101 | |||
960e8cf76d | |||
f29ad3c5c4 | |||
766873da13 |
|
@ -71,18 +71,21 @@
|
|||
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
||||
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
||||
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
||||
//
|
||||
// toolStripMenuItemSwitchLaneOutOut
|
||||
//
|
||||
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
||||
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
||||
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
||||
//
|
||||
// toolStripMenuItemSwitchLaneOutIn
|
||||
//
|
||||
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
||||
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
||||
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
|
||||
//
|
||||
// AIParkingApplicationForm
|
||||
//
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
public partial class AIParkingApplicationForm : Form
|
||||
{
|
||||
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
|
||||
private ApiController apiController;
|
||||
private IDoorControlAccess c3Device;
|
||||
private LaneIn laneIn;
|
||||
private LaneOut laneOut;
|
||||
private LaneIn laneIn12;
|
||||
private LaneIn laneIn56;
|
||||
private LaneOut laneOut34;
|
||||
private LaneOut laneOut78;
|
||||
private StatusBar statusBar;
|
||||
private Sidebar sidebar;
|
||||
private Config configOnWeb;
|
||||
|
@ -22,7 +25,7 @@ namespace AIParkingApplication
|
|||
this.configOnWeb = configOnWeb;
|
||||
|
||||
sidebar = new Sidebar(apiController);
|
||||
sidebar.Location = new System.Drawing.Point(0, 0);
|
||||
sidebar.Location = new Point(0, 0);
|
||||
Controls.Add(sidebar);
|
||||
|
||||
c3Device = new C3DeviceController("192.168.1.200");
|
||||
|
@ -36,32 +39,151 @@ namespace AIParkingApplication
|
|||
MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
laneIn = new LaneIn(1, this.configOnWeb.CameraData1.Id.ToString(), this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||
laneIn.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||
Controls.Add(laneIn);
|
||||
|
||||
laneOut = new LaneOut(2, this.configOnWeb.CameraData3.Id.ToString(), this.configOnWeb.CameraData3.StreamUrl, this.configOnWeb.CameraData4.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||
laneOut.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, menuStrip.Height);
|
||||
Controls.Add(laneOut);
|
||||
|
||||
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
||||
statusBar.Location = new System.Drawing.Point(0, sidebar.Location.Y + sidebar.Height + 20);
|
||||
statusBar.Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26);
|
||||
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
Controls.Add(statusBar);
|
||||
|
||||
StartLanes();
|
||||
InitAllLanes();
|
||||
}
|
||||
|
||||
private void StartLanes()
|
||||
private void InitAllLanes()
|
||||
{
|
||||
laneIn.Start();
|
||||
laneOut.Start();
|
||||
laneIn12 = new LaneIn(10, configOnWeb.CameraData1.Id.ToString(), configOnWeb.CameraData1.StreamUrl, configOnWeb.CameraData2.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
|
||||
laneIn12.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneIn12.Hide();
|
||||
Controls.Add(laneIn12);
|
||||
|
||||
laneOut34 = new LaneOut(20, configOnWeb.CameraData3.Id.ToString(), configOnWeb.CameraData3.StreamUrl, configOnWeb.CameraData4.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
|
||||
laneOut34.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneOut34.Hide();
|
||||
Controls.Add(laneOut34);
|
||||
|
||||
laneIn56 = new LaneIn(10, configOnWeb.CameraData5.Id.ToString(), configOnWeb.CameraData5.StreamUrl, configOnWeb.CameraData6.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
|
||||
laneIn56.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneIn56.Hide();
|
||||
Controls.Add(laneIn56);
|
||||
|
||||
laneOut78 = new LaneOut(20, configOnWeb.CameraData7.Id.ToString(), configOnWeb.CameraData7.StreamUrl, configOnWeb.CameraData8.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
|
||||
laneOut78.BorderStyle = BorderStyle.FixedSingle;
|
||||
laneOut78.Hide();
|
||||
Controls.Add(laneOut78);
|
||||
}
|
||||
|
||||
private void UpdateLaneInOut()
|
||||
{
|
||||
laneIn12.DoorId = 1;
|
||||
laneIn12.Location = new Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||
laneIn12.Show();
|
||||
laneIn12.Start();
|
||||
|
||||
laneOut34.DoorId = 2;
|
||||
laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||
laneOut34.Show();
|
||||
laneOut34.Start();
|
||||
}
|
||||
|
||||
private void UpdateLaneInIn()
|
||||
{
|
||||
laneIn12.DoorId = 1;
|
||||
laneIn12.Location = new Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||
laneIn12.Show();
|
||||
laneIn12.Start();
|
||||
|
||||
laneIn56.DoorId = 2;
|
||||
laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||
laneIn56.Show();
|
||||
laneIn56.Start();
|
||||
}
|
||||
|
||||
private void UpdateLaneOutIn()
|
||||
{
|
||||
laneOut78.DoorId = 1;
|
||||
laneOut78.Location = new Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||
laneOut78.Show();
|
||||
laneOut78.Start();
|
||||
|
||||
laneIn56.DoorId = 2;
|
||||
laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||
laneIn56.Show();
|
||||
laneIn56.Start();
|
||||
}
|
||||
|
||||
private void UpdateLaneOutOut()
|
||||
{
|
||||
laneOut78.DoorId = 1;
|
||||
laneOut78.Location = new Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||
laneOut78.Show();
|
||||
laneOut78.Start();
|
||||
|
||||
laneOut34.DoorId = 2;
|
||||
laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||
laneOut34.Show();
|
||||
laneOut34.Start();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInIn();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInOut();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutIn();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutOut();
|
||||
}
|
||||
|
||||
private void UpdateMenuStripItemStatus(ToolStripMenuItem selectedToolStripMenuItem)
|
||||
{
|
||||
if (selectedToolStripMenuItem != null)
|
||||
{
|
||||
((ToolStripMenuItem)selectedToolStripMenuItem.OwnerItem).DropDownItems
|
||||
.OfType<ToolStripMenuItem>().ToList()
|
||||
.ForEach(item =>
|
||||
{
|
||||
item.Checked = false;
|
||||
item.Enabled = true;
|
||||
});
|
||||
|
||||
selectedToolStripMenuItem.Checked = true;
|
||||
selectedToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void StopAllLanes()
|
||||
{
|
||||
laneIn12.DoorId = 10;
|
||||
laneIn56.DoorId = 10;
|
||||
laneOut34.DoorId = 10;
|
||||
laneOut78.DoorId = 10;
|
||||
|
||||
laneIn12?.Stop();
|
||||
laneIn56?.Stop();
|
||||
laneOut34?.Stop();
|
||||
laneOut78?.Stop();
|
||||
|
||||
laneIn12?.Hide();
|
||||
laneIn56?.Hide();
|
||||
laneOut34?.Hide();
|
||||
laneOut78?.Hide();
|
||||
}
|
||||
|
||||
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace AIParkingApplication
|
|||
private Camera overviewCamera;
|
||||
private Camera plateCamera;
|
||||
private PlateProcessor plateProcessor;
|
||||
private int doorId;
|
||||
public int DoorId { get; set; }
|
||||
private string cameraId;
|
||||
private bool isSupportSquarePlate;
|
||||
private bool isSupportLongPlate;
|
||||
|
@ -35,7 +35,7 @@ namespace AIParkingApplication
|
|||
bool isRetryMode = false)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.doorId = doorId;
|
||||
DoorId = doorId;
|
||||
this.cameraId = cameraId;
|
||||
this.isSupportSquarePlate = isSupportSquarePlate;
|
||||
this.isSupportLongPlate = isSupportLongPlate;
|
||||
|
@ -50,7 +50,7 @@ namespace AIParkingApplication
|
|||
|
||||
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
||||
{
|
||||
if (this.doorId != doorId)
|
||||
if (DoorId != doorId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace AIParkingApplication
|
|||
|
||||
if (saveLogResult.Status)
|
||||
{
|
||||
if (isAutoOpenDoor && this.doorId == doorId)
|
||||
if (isAutoOpenDoor && DoorId == doorId)
|
||||
{
|
||||
OpenDoor(doorId);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace AIParkingApplication
|
|||
private Camera overviewCamera;
|
||||
private Camera plateCamera;
|
||||
private PlateProcessor plateProcessor;
|
||||
private int doorId;
|
||||
public int DoorId { get; set; }
|
||||
private string cameraId;
|
||||
private bool isSupportSquarePlate;
|
||||
private bool isSupportLongPlate;
|
||||
|
@ -36,7 +36,7 @@ namespace AIParkingApplication
|
|||
bool isRetryMode = false)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.doorId = doorId;
|
||||
DoorId = doorId;
|
||||
this.cameraId = cameraId;
|
||||
this.isSupportSquarePlate = isSupportSquarePlate;
|
||||
this.isSupportLongPlate = isSupportLongPlate;
|
||||
|
@ -52,7 +52,7 @@ namespace AIParkingApplication
|
|||
|
||||
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
||||
{
|
||||
if (this.doorId != doorId)
|
||||
if (DoorId != doorId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
32
AIParkingApplication/StatusBar.Designer.cs
generated
32
AIParkingApplication/StatusBar.Designer.cs
generated
|
@ -41,9 +41,9 @@
|
|||
// lblPingTimeServer
|
||||
//
|
||||
this.lblPingTimeServer.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblPingTimeServer.Location = new System.Drawing.Point(211, 0);
|
||||
this.lblPingTimeServer.Location = new System.Drawing.Point(212, 0);
|
||||
this.lblPingTimeServer.Name = "lblPingTimeServer";
|
||||
this.lblPingTimeServer.Size = new System.Drawing.Size(65, 24);
|
||||
this.lblPingTimeServer.Size = new System.Drawing.Size(65, 18);
|
||||
this.lblPingTimeServer.TabIndex = 0;
|
||||
this.lblPingTimeServer.Text = "1ms";
|
||||
this.lblPingTimeServer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -54,7 +54,7 @@
|
|||
this.lblDateTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblDateTime.Location = new System.Drawing.Point(1226, 0);
|
||||
this.lblDateTime.Name = "lblDateTime";
|
||||
this.lblDateTime.Size = new System.Drawing.Size(140, 24);
|
||||
this.lblDateTime.Size = new System.Drawing.Size(140, 18);
|
||||
this.lblDateTime.TabIndex = 2;
|
||||
this.lblDateTime.Text = "17/06/2020 16:54:43";
|
||||
this.lblDateTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -64,7 +64,7 @@
|
|||
this.lblPingDoorAccessControlDevice.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblPingDoorAccessControlDevice.Location = new System.Drawing.Point(316, 0);
|
||||
this.lblPingDoorAccessControlDevice.Name = "lblPingDoorAccessControlDevice";
|
||||
this.lblPingDoorAccessControlDevice.Size = new System.Drawing.Size(114, 24);
|
||||
this.lblPingDoorAccessControlDevice.Size = new System.Drawing.Size(114, 18);
|
||||
this.lblPingDoorAccessControlDevice.TabIndex = 3;
|
||||
this.lblPingDoorAccessControlDevice.Text = "Thiết bị mở cửa:";
|
||||
this.lblPingDoorAccessControlDevice.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -72,9 +72,9 @@
|
|||
// lblPingTimeToDoorAccessControl
|
||||
//
|
||||
this.lblPingTimeToDoorAccessControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblPingTimeToDoorAccessControl.Location = new System.Drawing.Point(437, 0);
|
||||
this.lblPingTimeToDoorAccessControl.Location = new System.Drawing.Point(440, 0);
|
||||
this.lblPingTimeToDoorAccessControl.Name = "lblPingTimeToDoorAccessControl";
|
||||
this.lblPingTimeToDoorAccessControl.Size = new System.Drawing.Size(71, 24);
|
||||
this.lblPingTimeToDoorAccessControl.Size = new System.Drawing.Size(71, 18);
|
||||
this.lblPingTimeToDoorAccessControl.TabIndex = 3;
|
||||
this.lblPingTimeToDoorAccessControl.Text = "500ms";
|
||||
this.lblPingTimeToDoorAccessControl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -84,7 +84,7 @@
|
|||
this.lblConnectionStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblConnectionStatus.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblConnectionStatus.Name = "lblConnectionStatus";
|
||||
this.lblConnectionStatus.Size = new System.Drawing.Size(125, 24);
|
||||
this.lblConnectionStatus.Size = new System.Drawing.Size(125, 18);
|
||||
this.lblConnectionStatus.TabIndex = 1;
|
||||
this.lblConnectionStatus.Text = "Trạng thái kết nối";
|
||||
this.lblConnectionStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -94,17 +94,17 @@
|
|||
this.lblServer.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblServer.Location = new System.Drawing.Point(142, 0);
|
||||
this.lblServer.Name = "lblServer";
|
||||
this.lblServer.Size = new System.Drawing.Size(63, 24);
|
||||
this.lblServer.Size = new System.Drawing.Size(63, 18);
|
||||
this.lblServer.TabIndex = 1;
|
||||
this.lblServer.Text = "Server";
|
||||
this.lblServer.Text = "Server:";
|
||||
this.lblServer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblEngine
|
||||
//
|
||||
this.lblEngine.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblEngine.Location = new System.Drawing.Point(570, 0);
|
||||
this.lblEngine.Location = new System.Drawing.Point(583, 0);
|
||||
this.lblEngine.Name = "lblEngine";
|
||||
this.lblEngine.Size = new System.Drawing.Size(65, 24);
|
||||
this.lblEngine.Size = new System.Drawing.Size(65, 18);
|
||||
this.lblEngine.TabIndex = 3;
|
||||
this.lblEngine.Text = "Engine:";
|
||||
this.lblEngine.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -112,9 +112,9 @@
|
|||
// lblEngineStatus
|
||||
//
|
||||
this.lblEngineStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblEngineStatus.Location = new System.Drawing.Point(641, 0);
|
||||
this.lblEngineStatus.Location = new System.Drawing.Point(654, 0);
|
||||
this.lblEngineStatus.Name = "lblEngineStatus";
|
||||
this.lblEngineStatus.Size = new System.Drawing.Size(169, 24);
|
||||
this.lblEngineStatus.Size = new System.Drawing.Size(169, 18);
|
||||
this.lblEngineStatus.TabIndex = 3;
|
||||
this.lblEngineStatus.Text = "---";
|
||||
this.lblEngineStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
|
@ -132,10 +132,10 @@
|
|||
this.Controls.Add(this.lblConnectionStatus);
|
||||
this.Controls.Add(this.lblPingTimeServer);
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.MaximumSize = new System.Drawing.Size(1366, 24);
|
||||
this.MinimumSize = new System.Drawing.Size(1366, 24);
|
||||
this.MaximumSize = new System.Drawing.Size(1366, 18);
|
||||
this.MinimumSize = new System.Drawing.Size(1366, 18);
|
||||
this.Name = "StatusBar";
|
||||
this.Size = new System.Drawing.Size(1366, 24);
|
||||
this.Size = new System.Drawing.Size(1366, 18);
|
||||
this.Load += new System.EventHandler(this.StatusBar_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user