Compare commits
25 Commits
646449b4ba
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97908a22b | ||
|
|
9400402141 | ||
|
|
59208674e0 | ||
|
|
aa73bf8129 | ||
|
|
aa1aae8c6c | ||
|
|
1671d3b456 | ||
|
|
a3543084b7 | ||
|
|
89e766714a | ||
|
|
fd96643412 | ||
|
|
1418b1077e | ||
|
|
53aa3e31ea | ||
|
|
076290e141 | ||
|
|
6284909fd8 | ||
|
|
68d84387b8 | ||
|
|
c0c8b325d0 | ||
|
|
2c6e326008 | ||
|
|
01098b4597 | ||
|
|
61f6be6093 | ||
|
|
d3a47432bb | ||
|
|
2c60eebda1 | ||
|
|
7c03df5229 | ||
|
|
c9b65ba883 | ||
|
|
a835ed626b | ||
|
|
79eca30267 | ||
|
|
87e3a7418a |
@@ -93,6 +93,9 @@
|
|||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -109,7 +112,6 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Deployment" />
|
<Reference Include="System.Deployment" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -125,6 +127,12 @@
|
|||||||
<Compile Include="AppConstant.cs" />
|
<Compile Include="AppConstant.cs" />
|
||||||
<Compile Include="C3DeviceController.cs" />
|
<Compile Include="C3DeviceController.cs" />
|
||||||
<Compile Include="Camera.cs" />
|
<Compile Include="Camera.cs" />
|
||||||
|
<Compile Include="ConfigurationForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ConfigurationForm.Designer.cs">
|
||||||
|
<DependentUpon>ConfigurationForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EngineApiController.cs" />
|
<Compile Include="EngineApiController.cs" />
|
||||||
<Compile Include="Enums.cs" />
|
<Compile Include="Enums.cs" />
|
||||||
<Compile Include="ExtensitionMethods.cs" />
|
<Compile Include="ExtensitionMethods.cs" />
|
||||||
@@ -175,6 +183,9 @@
|
|||||||
<EmbeddedResource Include="AIParkingApplicationForm.resx">
|
<EmbeddedResource Include="AIParkingApplicationForm.resx">
|
||||||
<DependentUpon>AIParkingApplicationForm.cs</DependentUpon>
|
<DependentUpon>AIParkingApplicationForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="ConfigurationForm.resx">
|
||||||
|
<DependentUpon>ConfigurationForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="LaneIn.resx">
|
<EmbeddedResource Include="LaneIn.resx">
|
||||||
<DependentUpon>LaneIn.cs</DependentUpon>
|
<DependentUpon>LaneIn.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
@@ -35,13 +35,15 @@
|
|||||||
this.toolStripMenuItemSwitchLaneInOut = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemSwitchLaneInOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItemSwitchLaneOutOut = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemSwitchLaneOutOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItemSwitchLaneOutIn = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemSwitchLaneOutIn = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.setupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip.SuspendLayout();
|
this.menuStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.toolStripMenuItemSwitchLane});
|
this.toolStripMenuItemSwitchLane,
|
||||||
|
this.setupToolStripMenuItem});
|
||||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip.Name = "menuStrip";
|
this.menuStrip.Name = "menuStrip";
|
||||||
this.menuStrip.Size = new System.Drawing.Size(1366, 24);
|
this.menuStrip.Size = new System.Drawing.Size(1366, 24);
|
||||||
@@ -62,31 +64,38 @@
|
|||||||
// toolStripMenuItemSwitchLaneInIn
|
// toolStripMenuItemSwitchLaneInIn
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
|
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(123, 22);
|
this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào";
|
this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào";
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneInOut
|
// toolStripMenuItemSwitchLaneInOut
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(123, 22);
|
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneOutOut
|
// toolStripMenuItemSwitchLaneOutOut
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(123, 22);
|
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneOutIn
|
// toolStripMenuItemSwitchLaneOutIn
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(123, 22);
|
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
|
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
|
||||||
//
|
//
|
||||||
|
// setupToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.setupToolStripMenuItem.Name = "setupToolStripMenuItem";
|
||||||
|
this.setupToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||||
|
this.setupToolStripMenuItem.Text = "Cài đặt";
|
||||||
|
this.setupToolStripMenuItem.Click += new System.EventHandler(this.setupToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// AIParkingApplicationForm
|
// AIParkingApplicationForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -116,6 +125,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInOut;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInOut;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutOut;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutOut;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutIn;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutIn;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem setupToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
public partial class AIParkingApplicationForm : Form
|
public partial class AIParkingApplicationForm : Form
|
||||||
{
|
{
|
||||||
private const string CURRENT_LANE_SETTING_KEY = "CURRENT_LANE_SETTING";
|
|
||||||
|
|
||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
private IDoorControlAccess c3Device;
|
private IDoorControlAccess c3Device;
|
||||||
private LaneIn laneIn12;
|
private LaneIn laneIn12;
|
||||||
@@ -63,26 +61,38 @@ 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);
|
MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
Application.ThreadException += Application_ThreadException;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
appLogger.Log(LogLevel.Error, $"Application.ThreadException. ex:{e.Exception.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
appLogger.Log(LogLevel.Error, $"AppDomain.CurrentDomain.UnhandledException. ex:{(e.ExceptionObject as Exception).Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitAllLanes()
|
private void InitAllLanes()
|
||||||
{
|
{
|
||||||
laneIn12 = new LaneIn(10, configOnWeb.CameraData1.Id.ToString(), configOnWeb.CameraData1.StreamUrl, configOnWeb.CameraData2.StreamUrl, c3Device, apiController, engineApiController, appLogger, true, false, true);
|
laneIn12 = new LaneIn(10, configOnWeb.CameraData1.Id.ToString(), configOnWeb.CameraData1.StreamUrl, configOnWeb.CameraData2.StreamUrl, c3Device, apiController, engineApiController, appLogger, configOnWeb.CameraData1.Roi_config, true, false, true);
|
||||||
laneIn12.BorderStyle = BorderStyle.FixedSingle;
|
laneIn12.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneIn12.Hide();
|
laneIn12.Hide();
|
||||||
Controls.Add(laneIn12);
|
Controls.Add(laneIn12);
|
||||||
|
|
||||||
laneOut34 = new LaneOut(20, configOnWeb.CameraData3.Id.ToString(), configOnWeb.CameraData3.StreamUrl, configOnWeb.CameraData4.StreamUrl, c3Device, apiController, engineApiController, appLogger, true, false, true);
|
laneOut34 = new LaneOut(20, configOnWeb.CameraData3.Id.ToString(), configOnWeb.CameraData3.StreamUrl, configOnWeb.CameraData4.StreamUrl, c3Device, apiController, engineApiController, appLogger, configOnWeb.CameraData3.Roi_config, true, false, true);
|
||||||
laneOut34.BorderStyle = BorderStyle.FixedSingle;
|
laneOut34.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneOut34.Hide();
|
laneOut34.Hide();
|
||||||
Controls.Add(laneOut34);
|
Controls.Add(laneOut34);
|
||||||
|
|
||||||
laneIn56 = new LaneIn(10, configOnWeb.CameraData5.Id.ToString(), configOnWeb.CameraData5.StreamUrl, configOnWeb.CameraData6.StreamUrl, c3Device, apiController, engineApiController, appLogger, true, false, true);
|
laneIn56 = new LaneIn(10, configOnWeb.CameraData5.Id.ToString(), configOnWeb.CameraData5.StreamUrl, configOnWeb.CameraData6.StreamUrl, c3Device, apiController, engineApiController, appLogger, configOnWeb.CameraData5.Roi_config, true, false, true);
|
||||||
laneIn56.BorderStyle = BorderStyle.FixedSingle;
|
laneIn56.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneIn56.Hide();
|
laneIn56.Hide();
|
||||||
Controls.Add(laneIn56);
|
Controls.Add(laneIn56);
|
||||||
|
|
||||||
laneOut78 = new LaneOut(20, configOnWeb.CameraData7.Id.ToString(), configOnWeb.CameraData7.StreamUrl, configOnWeb.CameraData8.StreamUrl, c3Device, apiController, engineApiController, appLogger, true, false, true);
|
laneOut78 = new LaneOut(20, configOnWeb.CameraData7.Id.ToString(), configOnWeb.CameraData7.StreamUrl, configOnWeb.CameraData8.StreamUrl, c3Device, apiController, engineApiController, appLogger, configOnWeb.CameraData7.Roi_config, true, false, true);
|
||||||
laneOut78.BorderStyle = BorderStyle.FixedSingle;
|
laneOut78.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneOut78.Hide();
|
laneOut78.Hide();
|
||||||
Controls.Add(laneOut78);
|
Controls.Add(laneOut78);
|
||||||
@@ -142,7 +152,7 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-IN");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-IN");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneInIn();
|
UpdateLaneInIn();
|
||||||
@@ -151,7 +161,7 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
@@ -160,7 +170,7 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-IN");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "OUT-IN");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneOutIn();
|
UpdateLaneOutIn();
|
||||||
@@ -169,7 +179,7 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-OUT");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "OUT-OUT");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneOutOut();
|
UpdateLaneOutOut();
|
||||||
@@ -215,7 +225,7 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string lanesConfig = ConfigurationManager.AppSettings[CURRENT_LANE_SETTING_KEY];
|
string lanesConfig = ConfigurationManager.AppSettings[AppConstant.CURRENT_LANE_SETTING];
|
||||||
if (!string.IsNullOrEmpty(lanesConfig))
|
if (!string.IsNullOrEmpty(lanesConfig))
|
||||||
{
|
{
|
||||||
string[] lanes = lanesConfig.Split('-');
|
string[] lanes = lanesConfig.Split('-');
|
||||||
@@ -250,7 +260,7 @@ namespace AIParkingApplication
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||||
appLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT");
|
appLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT");
|
||||||
@@ -259,7 +269,7 @@ namespace AIParkingApplication
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
||||||
@@ -271,13 +281,13 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doorAccessControlDeviceIP = ConfigurationManager.AppSettings["DOOR_ACCESS_DEVICE_CONTROL_IP"].Trim();
|
doorAccessControlDeviceIP = ConfigurationManager.AppSettings[AppConstant.DOOR_ACCESS_DEVICE_CONTROL_IP].Trim();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
doorAccessControlDeviceIP = string.Empty;
|
doorAccessControlDeviceIP = string.Empty;
|
||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
||||||
appLogger.Log(LogLevel.Error, $"Cấu hình IP thiết bị mở cửa lỗi(DOOR_ACCESS_DEVICE_CONTROL_IP)!\texMessage: {ex.Message}");
|
appLogger.Log(LogLevel.Error, $"Cấu hình IP thiết bị mở cửa lỗi({AppConstant.DOOR_ACCESS_DEVICE_CONTROL_IP})!\texMessage: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,5 +302,11 @@ namespace AIParkingApplication
|
|||||||
appLogger.Log(LogLevel.Info, $"Đóng ứng dụng");
|
appLogger.Log(LogLevel.Info, $"Đóng ứng dụng");
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var configurationForm = new ConfigurationForm(appLogger);
|
||||||
|
configurationForm.ShowDialog(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using OpenCvSharp;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
@@ -44,6 +45,7 @@ namespace AIParkingApplication
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
|
appLogger.Log(LogLevel.Error, $"Login lỗi. exMessage: {ex.Message}");
|
||||||
return new LoginDataModel
|
return new LoginDataModel
|
||||||
{
|
{
|
||||||
IsLoginSuccess = false,
|
IsLoginSuccess = false,
|
||||||
@@ -74,7 +76,7 @@ namespace AIParkingApplication
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
appLogger.Log(LogLevel.Info, $"Query dữ liệu thống kê bãi xe lỗi. exMessage: {ex.Message}");
|
appLogger.Log(LogLevel.Error, $"Query dữ liệu thống kê bãi xe lỗi. exMessage: {ex.Message}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,17 +86,13 @@ namespace AIParkingApplication
|
|||||||
int requestCounter = 1;
|
int requestCounter = 1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = new CardModel()
|
|
||||||
{
|
|
||||||
CardNumber = cardNumber
|
|
||||||
};
|
|
||||||
HttpResponseMessage response;
|
HttpResponseMessage response;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
response = await httpClient.PostAsJsonAsync("/api/check-card", request);
|
response = await httpClient.PostAsJsonAsync("/api/check-card", new CardModel { CardNumber = cardNumber });
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
requestCounter += 1;
|
requestCounter += 1;
|
||||||
await Task.Delay(100);
|
await Task.Delay(800);
|
||||||
}
|
}
|
||||||
while (response.StatusCode != HttpStatusCode.OK && requestCounter < numberOfRetry);
|
while (response.StatusCode != HttpStatusCode.OK && requestCounter < numberOfRetry);
|
||||||
|
|
||||||
@@ -104,12 +102,11 @@ namespace AIParkingApplication
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
appLogger.Log(LogLevel.Info, $"Query thông tin thẻ lỗi. Thẻ số: {cardNumber} | số lần thử lại: {requestCounter} | exMessage: {ex.Message}");
|
appLogger.Log(LogLevel.Error, $"Query thông tin thẻ lỗi. Thẻ số: {cardNumber} | số lần thử lại: {requestCounter} | exMessage: {ex.Message}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Neu Dicrection la Out thi logID la logID lay ve khi check the
|
|
||||||
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat plateFrameImage, Mat frameImage, string logID = "")
|
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat plateFrameImage, Mat frameImage, string logID = "")
|
||||||
{
|
{
|
||||||
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
||||||
@@ -141,7 +138,7 @@ namespace AIParkingApplication
|
|||||||
response = await httpClient.PostAsJsonAsync("/api/save-logs", request);
|
response = await httpClient.PostAsJsonAsync("/api/save-logs", request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
requestCounter += 1;
|
requestCounter += 1;
|
||||||
await Task.Delay(100);
|
await Task.Delay(800);
|
||||||
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < numberOfRetry);
|
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < numberOfRetry);
|
||||||
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
||||||
return saveLogRespone;
|
return saveLogRespone;
|
||||||
@@ -149,11 +146,41 @@ namespace AIParkingApplication
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
appLogger.Log(LogLevel.Info, string.Format("Không thể lưu log gửi xe. Làn: {0} | Mã thẻ: {1} | cameraID: {2} | Thời gian: {3} | Biển số: {4} | LogID: {5} | exMessage: ", direction == LaneDirection.In ? "IN" : "OUT", cardID, cameraID, timestamp, plateString, logID, ex.Message));
|
appLogger.Log(LogLevel.Error, string.Format("Không thể lưu log gửi xe. Làn: {0} | Mã thẻ: {1} | cameraID: {2} | Thời gian: {3} | Biển số: {4} | LogID: {5} | exMessage: ", direction == LaneDirection.In ? "IN" : "OUT", cardID, cameraID, timestamp, plateString, logID, ex.Message));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async void SaveRoiToServer(Rectangle roiRegion, string cameraId)
|
||||||
|
{
|
||||||
|
int requestCounter = 1;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var request = new RoiConfig
|
||||||
|
{
|
||||||
|
CameraID = cameraId,
|
||||||
|
X = roiRegion.X,
|
||||||
|
Y = roiRegion.Y,
|
||||||
|
Width = roiRegion.Width,
|
||||||
|
Height = roiRegion.Height
|
||||||
|
};
|
||||||
|
HttpResponseMessage response;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
response = await httpClient.PostAsJsonAsync("/api/update-roi", request);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
requestCounter += 1;
|
||||||
|
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < numberOfRetry);
|
||||||
|
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"SaveRoiConfig Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
|
appLogger.Log(LogLevel.Error, string.Format("Không thể lưu ROI Config | exMessage: " + ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (httpClient != null && !isHttpClientDisposabled)
|
if (httpClient != null && !isHttpClientDisposabled)
|
||||||
@@ -491,6 +518,7 @@ namespace AIParkingApplication
|
|||||||
public int Logs { get; set; }
|
public int Logs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region LaneConfig
|
#region LaneConfig
|
||||||
public class LaneConfig
|
public class LaneConfig
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,14 @@
|
|||||||
<add key="DOOR_ACCESS_DEVICE_CONTROL_IP" value="192.168.1.200" />
|
<add key="DOOR_ACCESS_DEVICE_CONTROL_IP" value="192.168.1.200" />
|
||||||
<add key="DEFAULT_USERNAME" value="cong1vao" />
|
<add key="DEFAULT_USERNAME" value="cong1vao" />
|
||||||
<add key="DEFAULT_PASSWORD" value="123456a@" />
|
<add key="DEFAULT_PASSWORD" value="123456a@" />
|
||||||
<add key="CURRENT_LANE_SETTING" value="OUT-OUT" />
|
<add key="DEFAULT_WEB_SERVER" value="192.168.1.122:80" />
|
||||||
|
<add key="CURRENT_LANE_SETTING" value="IN-OUT" />
|
||||||
|
<add key="AUTO_LOGIN" value="false" />
|
||||||
|
<add key="USE_PRINTER" value="false" />
|
||||||
|
<add key="AUTO_OPEN_DOOR_1" value="true" />
|
||||||
|
<add key="AUTO_OPEN_DOOR_2" value="true" />
|
||||||
|
<add key="ALLOW_CHANGE_ROI_RECT" value="true" />
|
||||||
|
<add key="AUTO_RUN_AT_STARTUP" value="false" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
@@ -15,6 +22,10 @@
|
|||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -6,11 +6,25 @@
|
|||||||
public const string ERROR_TITLE = "Lỗi";
|
public const string ERROR_TITLE = "Lỗi";
|
||||||
public const string DATETIME_FORMAT = "HH:mm:ss dd/MM/yyyy";
|
public const string DATETIME_FORMAT = "HH:mm:ss dd/MM/yyyy";
|
||||||
|
|
||||||
public const string CAMERA_FAILED_IMAGE_PATH = @"Images\CantConnectCamera.jpg";
|
public const string CAMERA_FAILED_IMAGE_PATH = @".\Images\CantConnectCamera.jpg";
|
||||||
public const string DEFAULT_LOGO_IMAGE = @".\Images\ApplicationLogo.ico";
|
public const string DEFAULT_LOGO_IMAGE = @".\Images\ApplicationLogo.ico";
|
||||||
|
|
||||||
public const string APPLICATION_LOGGER_NAME = "ApplicationLogger";
|
public const string APPLICATION_LOGGER_NAME = "ApplicationLogger";
|
||||||
public const string PING_SERVER_LOGGER_NAME = "PingServerLogger";
|
public const string PING_SERVER_LOGGER_NAME = "PingServerLogger";
|
||||||
public const string PING_DOOR_DEVICE_CONTROL_ACCESS_LOGGER_NAME = "PingDoorDeviceControlAccessLogger";
|
public const string PING_DOOR_DEVICE_CONTROL_ACCESS_LOGGER_NAME = "PingDoorDeviceControlAccessLogger";
|
||||||
|
|
||||||
|
#region App Config Key
|
||||||
|
public const string DOOR_ACCESS_DEVICE_CONTROL_IP = "DOOR_ACCESS_DEVICE_CONTROL_IP";
|
||||||
|
public const string DEFAULT_USERNAME = "DEFAULT_USERNAME";
|
||||||
|
public const string DEFAULT_PASSWORD = "DEFAULT_PASSWORD";
|
||||||
|
public const string DEFAULT_WEB_SERVER = "DEFAULT_WEB_SERVER";
|
||||||
|
public const string CURRENT_LANE_SETTING = "CURRENT_LANE_SETTING";
|
||||||
|
public const string AUTO_LOGIN = "AUTO_LOGIN";
|
||||||
|
public const string USE_PRINTER = "USE_PRINTER";
|
||||||
|
public const string AUTO_OPEN_DOOR_1 = "AUTO_OPEN_DOOR_1";
|
||||||
|
public const string AUTO_OPEN_DOOR_2 = "AUTO_OPEN_DOOR_2";
|
||||||
|
public const string ALLOW_CHANGE_ROI_RECT = "ALLOW_CHANGE_ROI_RECT";
|
||||||
|
public const string AUTO_RUN_AT_STARTUP = "AUTO_RUN_AT_STARTUP";
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
@@ -50,7 +51,7 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
if (!videoCapture.Open(streamUrl))
|
if (!videoCapture.Open(streamUrl))
|
||||||
{
|
{
|
||||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(Application.StartupPath + AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ namespace AIParkingApplication
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(Application.StartupPath + AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
290
AIParkingApplication/ConfigurationForm.Designer.cs
generated
Normal file
290
AIParkingApplication/ConfigurationForm.Designer.cs
generated
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
namespace AIParkingApplication
|
||||||
|
{
|
||||||
|
partial class ConfigurationForm
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus = new System.Windows.Forms.Label();
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP = new System.Windows.Forms.Button();
|
||||||
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
|
this.btnSaveSettings = new System.Windows.Forms.Button();
|
||||||
|
this.chkAllowChangeROIRect = new System.Windows.Forms.CheckBox();
|
||||||
|
this.chkAllowAutoDoor2 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.chkAllowAutoDoor1 = new System.Windows.Forms.CheckBox();
|
||||||
|
this.lblAllowChangeROIRect = new System.Windows.Forms.Label();
|
||||||
|
this.lblAllowAutoOpenDoorIn = new System.Windows.Forms.Label();
|
||||||
|
this.txtDoorDeviceControlAccessIP = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblDoorDeviceControlAccessIP = new System.Windows.Forms.Label();
|
||||||
|
this.lblAllowUsePrinter = new System.Windows.Forms.Label();
|
||||||
|
this.chkAllowUsePrinter = new System.Windows.Forms.CheckBox();
|
||||||
|
this.lblAllowAutoLogin = new System.Windows.Forms.Label();
|
||||||
|
this.chkAllowAutoLogin = new System.Windows.Forms.CheckBox();
|
||||||
|
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||||
|
this.toolStripStatusLabelSavedSettingStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
|
this.lblAllowAutoRun = new System.Windows.Forms.Label();
|
||||||
|
this.chkAllowAutoRunAtStartUp = new System.Windows.Forms.CheckBox();
|
||||||
|
this.statusStrip.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblDoorDeviceControlAccessIPStatus
|
||||||
|
//
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.AutoSize = true;
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.Location = new System.Drawing.Point(412, 9);
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.Name = "lblDoorDeviceControlAccessIPStatus";
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.Size = new System.Drawing.Size(58, 13);
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.TabIndex = 17;
|
||||||
|
this.lblDoorDeviceControlAccessIPStatus.Text = "Trạng thái:";
|
||||||
|
//
|
||||||
|
// btnCheckDoorDeviceControlAccessIP
|
||||||
|
//
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.Location = new System.Drawing.Point(330, 3);
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.Name = "btnCheckDoorDeviceControlAccessIP";
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.Size = new System.Drawing.Size(75, 24);
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.TabIndex = 2;
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.Text = "Kiểm tra";
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCheckDoorDeviceControlAccessIP.Click += new System.EventHandler(this.btnCheckDoorDeviceControlAccessIP_Click);
|
||||||
|
//
|
||||||
|
// btnClose
|
||||||
|
//
|
||||||
|
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btnClose.Location = new System.Drawing.Point(528, 207);
|
||||||
|
this.btnClose.Name = "btnClose";
|
||||||
|
this.btnClose.Size = new System.Drawing.Size(106, 41);
|
||||||
|
this.btnClose.TabIndex = 7;
|
||||||
|
this.btnClose.Text = "Đóng";
|
||||||
|
this.btnClose.UseVisualStyleBackColor = true;
|
||||||
|
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||||
|
//
|
||||||
|
// btnSaveSettings
|
||||||
|
//
|
||||||
|
this.btnSaveSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btnSaveSettings.Location = new System.Drawing.Point(416, 207);
|
||||||
|
this.btnSaveSettings.Name = "btnSaveSettings";
|
||||||
|
this.btnSaveSettings.Size = new System.Drawing.Size(106, 41);
|
||||||
|
this.btnSaveSettings.TabIndex = 0;
|
||||||
|
this.btnSaveSettings.Text = "Lưu";
|
||||||
|
this.btnSaveSettings.UseVisualStyleBackColor = true;
|
||||||
|
this.btnSaveSettings.Click += new System.EventHandler(this.btnSaveSettings_Click);
|
||||||
|
//
|
||||||
|
// chkAllowChangeROIRect
|
||||||
|
//
|
||||||
|
this.chkAllowChangeROIRect.AutoSize = true;
|
||||||
|
this.chkAllowChangeROIRect.Location = new System.Drawing.Point(252, 95);
|
||||||
|
this.chkAllowChangeROIRect.Name = "chkAllowChangeROIRect";
|
||||||
|
this.chkAllowChangeROIRect.Size = new System.Drawing.Size(72, 17);
|
||||||
|
this.chkAllowChangeROIRect.TabIndex = 5;
|
||||||
|
this.chkAllowChangeROIRect.Text = "Cho phép";
|
||||||
|
this.chkAllowChangeROIRect.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// chkAllowAutoDoor2
|
||||||
|
//
|
||||||
|
this.chkAllowAutoDoor2.AutoSize = true;
|
||||||
|
this.chkAllowAutoDoor2.Location = new System.Drawing.Point(252, 37);
|
||||||
|
this.chkAllowAutoDoor2.Name = "chkAllowAutoDoor2";
|
||||||
|
this.chkAllowAutoDoor2.Size = new System.Drawing.Size(68, 17);
|
||||||
|
this.chkAllowAutoDoor2.TabIndex = 4;
|
||||||
|
this.chkAllowAutoDoor2.Text = "Cửa số 2";
|
||||||
|
this.chkAllowAutoDoor2.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// chkAllowAutoDoor1
|
||||||
|
//
|
||||||
|
this.chkAllowAutoDoor1.AutoSize = true;
|
||||||
|
this.chkAllowAutoDoor1.Location = new System.Drawing.Point(141, 37);
|
||||||
|
this.chkAllowAutoDoor1.Name = "chkAllowAutoDoor1";
|
||||||
|
this.chkAllowAutoDoor1.Size = new System.Drawing.Size(68, 17);
|
||||||
|
this.chkAllowAutoDoor1.TabIndex = 3;
|
||||||
|
this.chkAllowAutoDoor1.Text = "Cửa số 1";
|
||||||
|
this.chkAllowAutoDoor1.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// lblAllowChangeROIRect
|
||||||
|
//
|
||||||
|
this.lblAllowChangeROIRect.AutoSize = true;
|
||||||
|
this.lblAllowChangeROIRect.Location = new System.Drawing.Point(11, 96);
|
||||||
|
this.lblAllowChangeROIRect.Name = "lblAllowChangeROIRect";
|
||||||
|
this.lblAllowChangeROIRect.Size = new System.Drawing.Size(211, 13);
|
||||||
|
this.lblAllowChangeROIRect.TabIndex = 9;
|
||||||
|
this.lblAllowChangeROIRect.Text = "Cho phép thay đổi vùng nhận diện biển số:";
|
||||||
|
//
|
||||||
|
// lblAllowAutoOpenDoorIn
|
||||||
|
//
|
||||||
|
this.lblAllowAutoOpenDoorIn.AutoSize = true;
|
||||||
|
this.lblAllowAutoOpenDoorIn.Location = new System.Drawing.Point(11, 39);
|
||||||
|
this.lblAllowAutoOpenDoorIn.Name = "lblAllowAutoOpenDoorIn";
|
||||||
|
this.lblAllowAutoOpenDoorIn.Size = new System.Drawing.Size(89, 13);
|
||||||
|
this.lblAllowAutoOpenDoorIn.TabIndex = 10;
|
||||||
|
this.lblAllowAutoOpenDoorIn.Text = "Tự động mở cửa:";
|
||||||
|
//
|
||||||
|
// txtDoorDeviceControlAccessIP
|
||||||
|
//
|
||||||
|
this.txtDoorDeviceControlAccessIP.Location = new System.Drawing.Point(141, 5);
|
||||||
|
this.txtDoorDeviceControlAccessIP.Name = "txtDoorDeviceControlAccessIP";
|
||||||
|
this.txtDoorDeviceControlAccessIP.Size = new System.Drawing.Size(183, 20);
|
||||||
|
this.txtDoorDeviceControlAccessIP.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// lblDoorDeviceControlAccessIP
|
||||||
|
//
|
||||||
|
this.lblDoorDeviceControlAccessIP.AutoSize = true;
|
||||||
|
this.lblDoorDeviceControlAccessIP.Location = new System.Drawing.Point(12, 9);
|
||||||
|
this.lblDoorDeviceControlAccessIP.Name = "lblDoorDeviceControlAccessIP";
|
||||||
|
this.lblDoorDeviceControlAccessIP.Size = new System.Drawing.Size(96, 13);
|
||||||
|
this.lblDoorDeviceControlAccessIP.TabIndex = 7;
|
||||||
|
this.lblDoorDeviceControlAccessIP.Text = "IP Thiết bị mở cửa:";
|
||||||
|
//
|
||||||
|
// lblAllowUsePrinter
|
||||||
|
//
|
||||||
|
this.lblAllowUsePrinter.AutoSize = true;
|
||||||
|
this.lblAllowUsePrinter.Location = new System.Drawing.Point(11, 67);
|
||||||
|
this.lblAllowUsePrinter.Name = "lblAllowUsePrinter";
|
||||||
|
this.lblAllowUsePrinter.Size = new System.Drawing.Size(83, 13);
|
||||||
|
this.lblAllowUsePrinter.TabIndex = 9;
|
||||||
|
this.lblAllowUsePrinter.Text = "Sử dụng máy in:";
|
||||||
|
//
|
||||||
|
// chkAllowUsePrinter
|
||||||
|
//
|
||||||
|
this.chkAllowUsePrinter.AutoSize = true;
|
||||||
|
this.chkAllowUsePrinter.Location = new System.Drawing.Point(141, 66);
|
||||||
|
this.chkAllowUsePrinter.Name = "chkAllowUsePrinter";
|
||||||
|
this.chkAllowUsePrinter.Size = new System.Drawing.Size(66, 17);
|
||||||
|
this.chkAllowUsePrinter.TabIndex = 5;
|
||||||
|
this.chkAllowUsePrinter.Text = "Sử dụng";
|
||||||
|
this.chkAllowUsePrinter.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// lblAllowAutoLogin
|
||||||
|
//
|
||||||
|
this.lblAllowAutoLogin.AutoSize = true;
|
||||||
|
this.lblAllowAutoLogin.Location = new System.Drawing.Point(11, 129);
|
||||||
|
this.lblAllowAutoLogin.Name = "lblAllowAutoLogin";
|
||||||
|
this.lblAllowAutoLogin.Size = new System.Drawing.Size(106, 13);
|
||||||
|
this.lblAllowAutoLogin.TabIndex = 9;
|
||||||
|
this.lblAllowAutoLogin.Text = "Tự động đăng nhập:";
|
||||||
|
//
|
||||||
|
// chkAllowAutoLogin
|
||||||
|
//
|
||||||
|
this.chkAllowAutoLogin.AutoSize = true;
|
||||||
|
this.chkAllowAutoLogin.Location = new System.Drawing.Point(141, 128);
|
||||||
|
this.chkAllowAutoLogin.Name = "chkAllowAutoLogin";
|
||||||
|
this.chkAllowAutoLogin.Size = new System.Drawing.Size(66, 17);
|
||||||
|
this.chkAllowAutoLogin.TabIndex = 5;
|
||||||
|
this.chkAllowAutoLogin.Text = "Sử dụng";
|
||||||
|
this.chkAllowAutoLogin.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// statusStrip
|
||||||
|
//
|
||||||
|
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripStatusLabelSavedSettingStatus});
|
||||||
|
this.statusStrip.Location = new System.Drawing.Point(0, 259);
|
||||||
|
this.statusStrip.Name = "statusStrip";
|
||||||
|
this.statusStrip.Size = new System.Drawing.Size(646, 22);
|
||||||
|
this.statusStrip.TabIndex = 18;
|
||||||
|
this.statusStrip.Text = "statusStrip";
|
||||||
|
//
|
||||||
|
// toolStripStatusLabelSavedSettingStatus
|
||||||
|
//
|
||||||
|
this.toolStripStatusLabelSavedSettingStatus.Name = "toolStripStatusLabelSavedSettingStatus";
|
||||||
|
this.toolStripStatusLabelSavedSettingStatus.Size = new System.Drawing.Size(110, 17);
|
||||||
|
this.toolStripStatusLabelSavedSettingStatus.Text = "Cấu hình ứng dụng";
|
||||||
|
//
|
||||||
|
// lblAllowAutoRun
|
||||||
|
//
|
||||||
|
this.lblAllowAutoRun.AutoSize = true;
|
||||||
|
this.lblAllowAutoRun.Location = new System.Drawing.Point(11, 161);
|
||||||
|
this.lblAllowAutoRun.Name = "lblAllowAutoRun";
|
||||||
|
this.lblAllowAutoRun.Size = new System.Drawing.Size(122, 13);
|
||||||
|
this.lblAllowAutoRun.TabIndex = 9;
|
||||||
|
this.lblAllowAutoRun.Text = "Tự khởi động ứng dụng:";
|
||||||
|
//
|
||||||
|
// chkAllowAutoRunAtStartUp
|
||||||
|
//
|
||||||
|
this.chkAllowAutoRunAtStartUp.AutoSize = true;
|
||||||
|
this.chkAllowAutoRunAtStartUp.Location = new System.Drawing.Point(141, 160);
|
||||||
|
this.chkAllowAutoRunAtStartUp.Name = "chkAllowAutoRunAtStartUp";
|
||||||
|
this.chkAllowAutoRunAtStartUp.Size = new System.Drawing.Size(66, 17);
|
||||||
|
this.chkAllowAutoRunAtStartUp.TabIndex = 5;
|
||||||
|
this.chkAllowAutoRunAtStartUp.Text = "Sử dụng";
|
||||||
|
this.chkAllowAutoRunAtStartUp.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// ConfigurationForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(646, 281);
|
||||||
|
this.Controls.Add(this.statusStrip);
|
||||||
|
this.Controls.Add(this.lblDoorDeviceControlAccessIPStatus);
|
||||||
|
this.Controls.Add(this.btnCheckDoorDeviceControlAccessIP);
|
||||||
|
this.Controls.Add(this.btnClose);
|
||||||
|
this.Controls.Add(this.btnSaveSettings);
|
||||||
|
this.Controls.Add(this.chkAllowAutoRunAtStartUp);
|
||||||
|
this.Controls.Add(this.chkAllowAutoLogin);
|
||||||
|
this.Controls.Add(this.chkAllowUsePrinter);
|
||||||
|
this.Controls.Add(this.chkAllowChangeROIRect);
|
||||||
|
this.Controls.Add(this.lblAllowAutoRun);
|
||||||
|
this.Controls.Add(this.chkAllowAutoDoor2);
|
||||||
|
this.Controls.Add(this.lblAllowAutoLogin);
|
||||||
|
this.Controls.Add(this.chkAllowAutoDoor1);
|
||||||
|
this.Controls.Add(this.lblAllowUsePrinter);
|
||||||
|
this.Controls.Add(this.lblAllowChangeROIRect);
|
||||||
|
this.Controls.Add(this.lblAllowAutoOpenDoorIn);
|
||||||
|
this.Controls.Add(this.txtDoorDeviceControlAccessIP);
|
||||||
|
this.Controls.Add(this.lblDoorDeviceControlAccessIP);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.MaximumSize = new System.Drawing.Size(662, 320);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(662, 320);
|
||||||
|
this.Name = "ConfigurationForm";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Cấu hình ứng dụng";
|
||||||
|
this.Load += new System.EventHandler(this.ConfigurationForm_Load);
|
||||||
|
this.statusStrip.ResumeLayout(false);
|
||||||
|
this.statusStrip.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Label lblDoorDeviceControlAccessIPStatus;
|
||||||
|
private System.Windows.Forms.Button btnCheckDoorDeviceControlAccessIP;
|
||||||
|
private System.Windows.Forms.Button btnClose;
|
||||||
|
private System.Windows.Forms.Button btnSaveSettings;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowChangeROIRect;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowAutoDoor2;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowAutoDoor1;
|
||||||
|
private System.Windows.Forms.Label lblAllowChangeROIRect;
|
||||||
|
private System.Windows.Forms.Label lblAllowAutoOpenDoorIn;
|
||||||
|
private System.Windows.Forms.TextBox txtDoorDeviceControlAccessIP;
|
||||||
|
private System.Windows.Forms.Label lblDoorDeviceControlAccessIP;
|
||||||
|
private System.Windows.Forms.Label lblAllowUsePrinter;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowUsePrinter;
|
||||||
|
private System.Windows.Forms.Label lblAllowAutoLogin;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowAutoLogin;
|
||||||
|
private System.Windows.Forms.StatusStrip statusStrip;
|
||||||
|
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSavedSettingStatus;
|
||||||
|
private System.Windows.Forms.Label lblAllowAutoRun;
|
||||||
|
private System.Windows.Forms.CheckBox chkAllowAutoRunAtStartUp;
|
||||||
|
}
|
||||||
|
}
|
||||||
108
AIParkingApplication/ConfigurationForm.cs
Normal file
108
AIParkingApplication/ConfigurationForm.cs
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AIParkingApplication
|
||||||
|
{
|
||||||
|
public partial class ConfigurationForm : Form
|
||||||
|
{
|
||||||
|
private Logger appLogger;
|
||||||
|
private string doorAccessControlDeviceIP;
|
||||||
|
private bool allowAutoOpenDoor1;
|
||||||
|
private bool allowAutoOpenDoor2;
|
||||||
|
private bool allowUsePrinter;
|
||||||
|
private bool allowChangeROIRect;
|
||||||
|
private bool allowAutoLogin;
|
||||||
|
private bool allowAutoRunAtStartUp;
|
||||||
|
|
||||||
|
public ConfigurationForm(Logger appLogger)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.appLogger = appLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSaveSettings_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bool isValidIPAddress = Util.IsValidIPAddress(txtDoorDeviceControlAccessIP.Text);
|
||||||
|
if (!isValidIPAddress)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Nhập đúng IP thiết bị mở cửa!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Util.UpsertAppSettings(AppConstant.DOOR_ACCESS_DEVICE_CONTROL_IP, txtDoorDeviceControlAccessIP.Text);
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_OPEN_DOOR_1, chkAllowAutoDoor1.Checked.ToString().ToLower());
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_OPEN_DOOR_2, chkAllowAutoDoor2.Checked.ToString().ToLower());
|
||||||
|
Util.UpsertAppSettings(AppConstant.USE_PRINTER, chkAllowUsePrinter.Checked.ToString().ToLower());
|
||||||
|
Util.UpsertAppSettings(AppConstant.ALLOW_CHANGE_ROI_RECT, chkAllowChangeROIRect.Checked.ToString().ToLower());
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_LOGIN, chkAllowAutoLogin.Checked.ToString().ToLower());
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_RUN_AT_STARTUP, chkAllowAutoRunAtStartUp.Checked.ToString().ToLower());
|
||||||
|
if (chkAllowAutoRunAtStartUp.Checked)
|
||||||
|
{
|
||||||
|
Util.AddApplicationToStartup();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util.RemoveApplicationFromStartup();
|
||||||
|
}
|
||||||
|
toolStripStatusLabelSavedSettingStatus.Text = $"{DateTime.Now.GetTimeFormatted()} Đã lưu cài đặt";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurationForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadConfiguration();
|
||||||
|
txtDoorDeviceControlAccessIP.Text = doorAccessControlDeviceIP;
|
||||||
|
chkAllowAutoDoor1.Checked = allowAutoOpenDoor1;
|
||||||
|
chkAllowAutoDoor2.Checked = allowAutoOpenDoor2;
|
||||||
|
chkAllowUsePrinter.Checked = allowUsePrinter;
|
||||||
|
chkAllowChangeROIRect.Checked = allowChangeROIRect;
|
||||||
|
chkAllowAutoLogin.Checked = allowAutoLogin;
|
||||||
|
chkAllowAutoRunAtStartUp.Checked = allowAutoRunAtStartUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadConfiguration()
|
||||||
|
{
|
||||||
|
doorAccessControlDeviceIP = ReadConfigurationFromAppSettings(AppConstant.DOOR_ACCESS_DEVICE_CONTROL_IP, string.Empty);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.AUTO_OPEN_DOOR_1, "false"), out allowAutoOpenDoor1);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.AUTO_OPEN_DOOR_2, "false"), out allowAutoOpenDoor2);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.USE_PRINTER, "false"), out allowUsePrinter);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.ALLOW_CHANGE_ROI_RECT, "false"), out allowChangeROIRect);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.AUTO_LOGIN, "false"), out allowAutoLogin);
|
||||||
|
bool.TryParse(ReadConfigurationFromAppSettings(AppConstant.AUTO_RUN_AT_STARTUP, "false"), out allowAutoRunAtStartUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ReadConfigurationFromAppSettings(string configurationKey, string defaultValueIfReadFailed)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ConfigurationManager.AppSettings[configurationKey].Trim();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Util.UpsertAppSettings(configurationKey, defaultValueIfReadFailed);
|
||||||
|
Console.WriteLine($"ReadDoorDeviceControlAccessConfiguration. ex: {ex.Message}");
|
||||||
|
appLogger.Log(LogLevel.Info, $"ConfigurationForm - ReadConfigurationFromAppSettings. Key: {configurationKey} - DefaultValue: {defaultValueIfReadFailed}. ex: {ex.Message}");
|
||||||
|
return defaultValueIfReadFailed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCheckDoorDeviceControlAccessIP_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
lblDoorDeviceControlAccessIPStatus.Text = string.Empty;
|
||||||
|
bool isValidIPAddress = Util.IsValidIPAddress(txtDoorDeviceControlAccessIP.Text);
|
||||||
|
if (!isValidIPAddress)
|
||||||
|
{
|
||||||
|
lblDoorDeviceControlAccessIPStatus.Text = "Không đúng định dạng IP";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblDoorDeviceControlAccessIPStatus.Text = "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
AIParkingApplication/ConfigurationForm.resx
Normal file
123
AIParkingApplication/ConfigurationForm.resx
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
4
AIParkingApplication/LaneIn.Designer.cs
generated
4
AIParkingApplication/LaneIn.Designer.cs
generated
@@ -69,6 +69,10 @@
|
|||||||
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.pictureBoxPlateVideo.TabIndex = 0;
|
this.pictureBoxPlateVideo.TabIndex = 0;
|
||||||
this.pictureBoxPlateVideo.TabStop = false;
|
this.pictureBoxPlateVideo.TabStop = false;
|
||||||
|
this.pictureBoxPlateVideo.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxPlateVideo_Paint);
|
||||||
|
this.pictureBoxPlateVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseDown);
|
||||||
|
this.pictureBoxPlateVideo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseMove);
|
||||||
|
this.pictureBoxPlateVideo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseUp);
|
||||||
//
|
//
|
||||||
// grbPlateCamera
|
// grbPlateCamera
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Printing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using OpenCvSharp.Extensions;
|
using OpenCvSharp.Extensions;
|
||||||
@@ -24,6 +27,12 @@ namespace AIParkingApplication
|
|||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
private Logger appLogger;
|
private Logger appLogger;
|
||||||
|
|
||||||
|
private System.Drawing.Point StartPoint { get; set; }
|
||||||
|
private System.Drawing.Point CurrentCursorPosition { get; set; }
|
||||||
|
private Rectangle pictureBoxRoi;
|
||||||
|
private bool IsDrawBox { get; set; }
|
||||||
|
private Rect roiBoxRect;
|
||||||
|
|
||||||
public LaneIn(int doorId,
|
public LaneIn(int doorId,
|
||||||
string cameraId,
|
string cameraId,
|
||||||
string plateStream,
|
string plateStream,
|
||||||
@@ -32,6 +41,7 @@ namespace AIParkingApplication
|
|||||||
ApiController apiController,
|
ApiController apiController,
|
||||||
EngineApiController engineApiController,
|
EngineApiController engineApiController,
|
||||||
Logger appLogger,
|
Logger appLogger,
|
||||||
|
string roiConfig,
|
||||||
bool isSupportSquarePlate = true,
|
bool isSupportSquarePlate = true,
|
||||||
bool isSupportLongPlate = false,
|
bool isSupportLongPlate = false,
|
||||||
bool isAutoOpenDoor = true,
|
bool isAutoOpenDoor = true,
|
||||||
@@ -50,6 +60,7 @@ namespace AIParkingApplication
|
|||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.doorControlAccess = doorControlAccess;
|
this.doorControlAccess = doorControlAccess;
|
||||||
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||||
|
this.pictureBoxRoi = Util.ConvertStringToRectangle(roiConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
||||||
@@ -69,14 +80,14 @@ namespace AIParkingApplication
|
|||||||
if (!cardInfoResult.IsValid)
|
if (!cardInfoResult.IsValid)
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardInfoResult.Direction != "in")
|
if (cardInfoResult.Direction != "in")
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("XE ĐÃ Ở TRONG BÃI", Color.Red);
|
lblStatusInfo.UpdateLabel("XE ĐÃ Ở TRONG BÃI", Color.Red);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: XE ĐÃ Ở TRONG BÃI");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: XE ĐÃ Ở TRONG BÃI");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,26 +157,32 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
||||||
{
|
{
|
||||||
|
var starTime = DateTime.Now;
|
||||||
|
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
|
||||||
|
roiBoxRect = Util.ConvertRectangleToRect(pictureBoxRoi, pictureBoxPlateVideo);
|
||||||
|
Mat frameRoi = frame[roiBoxRect];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
|
|
||||||
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frameRoi);
|
||||||
|
|
||||||
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
||||||
{
|
{
|
||||||
Console.WriteLine("ProcessFrameImage Retry Mode");
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
overviewCamera.RequestCaptureOneFrame();
|
overviewCamera.RequestCaptureOneFrame();
|
||||||
finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
finalPlateResult = await plateProcessor.ProcessPlate(frameRoi);
|
||||||
|
Console.WriteLine("ProcessFrameImage Retry Mode");
|
||||||
}
|
}
|
||||||
|
appLogger.Log(LogLevel.Info, $"ProcessFrameImage: {(DateTime.Now - starTime).TotalMilliseconds} ms");
|
||||||
return finalPlateResult;
|
return finalPlateResult;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProcessFrameImage\texMessage: {ex.Message}");
|
Console.WriteLine($"ProcessFrameImage\texMessage: {ex.Message}");
|
||||||
|
appLogger.Log(LogLevel.Info, $"ProcessFrameImage: ex: {ex.Message}");
|
||||||
return new FinalPlateResult
|
return new FinalPlateResult
|
||||||
{
|
{
|
||||||
PlateImage = frame,
|
PlateImage = frameRoi,
|
||||||
PlateString = string.Empty,
|
PlateString = string.Empty,
|
||||||
PlateType = PlateType.Square
|
PlateType = PlateType.Square
|
||||||
};
|
};
|
||||||
@@ -231,5 +248,44 @@ namespace AIParkingApplication
|
|||||||
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
||||||
ConnectToDoorAccessControl();
|
ConnectToDoorAccessControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
StartPoint = e.Location;
|
||||||
|
pictureBoxRoi = new Rectangle(StartPoint, new System.Drawing.Size(0, 0));
|
||||||
|
IsDrawBox = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (IsDrawBox)
|
||||||
|
{
|
||||||
|
CurrentCursorPosition = e.Location;
|
||||||
|
pictureBoxRoi.Width = CurrentCursorPosition.X - StartPoint.X;
|
||||||
|
pictureBoxRoi.Height = CurrentCursorPosition.Y - StartPoint.Y;
|
||||||
|
}
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseUp(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
IsDrawBox = false;
|
||||||
|
if (StartPoint.X + pictureBoxRoi.Width > pictureBoxPlateVideo.Width || StartPoint.Y + pictureBoxRoi.Height > pictureBoxPlateVideo.Height)
|
||||||
|
{
|
||||||
|
pictureBoxRoi.X = pictureBoxRoi.Y = 0;
|
||||||
|
pictureBoxRoi.Width = pictureBoxPlateVideo.Width;
|
||||||
|
pictureBoxRoi.Height = pictureBoxPlateVideo.Height;
|
||||||
|
}
|
||||||
|
apiController.SaveRoiToServer(pictureBoxRoi, cameraId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Pen redPen = new Pen(Color.FromArgb(255, 255, 0, 0), 3);
|
||||||
|
e.Graphics.DrawRectangle(redPen, pictureBoxRoi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,6 +153,12 @@
|
|||||||
<metadata name="lblPlateString.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="lblPlateString.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="lblCardTime.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblPlateString.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="lblStatusInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="lblStatusInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
4
AIParkingApplication/LaneOut.Designer.cs
generated
4
AIParkingApplication/LaneOut.Designer.cs
generated
@@ -182,6 +182,10 @@
|
|||||||
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.pictureBoxPlateVideo.TabIndex = 0;
|
this.pictureBoxPlateVideo.TabIndex = 0;
|
||||||
this.pictureBoxPlateVideo.TabStop = false;
|
this.pictureBoxPlateVideo.TabStop = false;
|
||||||
|
this.pictureBoxPlateVideo.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxPlateVideo_Paint);
|
||||||
|
this.pictureBoxPlateVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseDown);
|
||||||
|
this.pictureBoxPlateVideo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseMove);
|
||||||
|
this.pictureBoxPlateVideo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseUp);
|
||||||
//
|
//
|
||||||
// grbPlateCamera
|
// grbPlateCamera
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -24,6 +25,13 @@ namespace AIParkingApplication
|
|||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
private Printer printer;
|
private Printer printer;
|
||||||
private Logger appLogger;
|
private Logger appLogger;
|
||||||
|
private bool isUsePrinter;
|
||||||
|
|
||||||
|
private System.Drawing.Point StartPoint { get; set; }
|
||||||
|
private System.Drawing.Point CurrentCursorPosition { get; set; }
|
||||||
|
private Rectangle pictureBoxRoi;
|
||||||
|
private bool IsDrawBox { get; set; }
|
||||||
|
private Rect roiBoxRect;
|
||||||
|
|
||||||
public LaneOut(int doorId,
|
public LaneOut(int doorId,
|
||||||
string cameraId,
|
string cameraId,
|
||||||
@@ -33,6 +41,7 @@ namespace AIParkingApplication
|
|||||||
ApiController apiController,
|
ApiController apiController,
|
||||||
EngineApiController engineApiController,
|
EngineApiController engineApiController,
|
||||||
Logger appLogger,
|
Logger appLogger,
|
||||||
|
string roiConfig,
|
||||||
bool isSupportSquarePlate = true,
|
bool isSupportSquarePlate = true,
|
||||||
bool isSupportLongPlate = false,
|
bool isSupportLongPlate = false,
|
||||||
bool isAutoOpenDoor = true,
|
bool isAutoOpenDoor = true,
|
||||||
@@ -52,6 +61,8 @@ namespace AIParkingApplication
|
|||||||
this.doorControlAccess = doorControlAccess;
|
this.doorControlAccess = doorControlAccess;
|
||||||
printer = new Printer(appLogger);
|
printer = new Printer(appLogger);
|
||||||
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||||
|
ReadUsePrinterConfig();
|
||||||
|
this.pictureBoxRoi = Util.ConvertStringToRectangle(roiConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
||||||
@@ -66,20 +77,20 @@ namespace AIParkingApplication
|
|||||||
if (cardInfoResult == null)
|
if (cardInfoResult == null)
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG THỂ KẾT NỐI TỚI SERVER");
|
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | lỗi: KHÔNG THỂ KẾT NỐI TỚI SERVER");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!cardInfoResult.IsValid)
|
if (!cardInfoResult.IsValid)
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardInfoResult.Direction != "out")
|
if (cardInfoResult.Direction != "out")
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("CHƯA NHẬN THẺ VÀO", Color.Red);
|
lblStatusInfo.UpdateLabel("CHƯA NHẬN THẺ VÀO", Color.Red);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: XE ĐÃ Ở TRONG BÃI");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | lỗi: CHƯA NHẬN THẺ VÀO");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +103,7 @@ namespace AIParkingApplication
|
|||||||
plateCamera.RequestCaptureOneFrame();
|
plateCamera.RequestCaptureOneFrame();
|
||||||
overviewCamera.RequestCaptureOneFrame();
|
overviewCamera.RequestCaptureOneFrame();
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | Chụp ảnh camera");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | Chụp ảnh camera");
|
||||||
|
|
||||||
var plateVideoFrame = plateCamera.CurrentFrame;
|
var plateVideoFrame = plateCamera.CurrentFrame;
|
||||||
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
||||||
@@ -108,7 +119,7 @@ namespace AIParkingApplication
|
|||||||
if (saveLogResult == null)
|
if (saveLogResult == null)
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ - KHÔNG LƯU ĐƯỢC LOG");
|
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | lỗi: KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ - KHÔNG LƯU ĐƯỢC LOG");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,24 +130,41 @@ namespace AIParkingApplication
|
|||||||
if (isAutoOpenDoor)
|
if (isAutoOpenDoor)
|
||||||
{
|
{
|
||||||
OpenDoor(doorId);
|
OpenDoor(doorId);
|
||||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | biển số: {result.PlateString} | Đã mở cửa");
|
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | biển số: {result.PlateString} | Đã mở cửa");
|
||||||
}
|
}
|
||||||
PrinterData printerData = new PrinterData
|
|
||||||
|
if (isUsePrinter)
|
||||||
{
|
{
|
||||||
PlateString = result.PlateString,
|
PrinterData printerData = new PrinterData
|
||||||
MoneyAmount = saveLogResult.Cost,
|
{
|
||||||
TimeParkingIn = cardInformation.TimeIn,
|
PlateString = result.PlateString,
|
||||||
TimeParkingOut = DateTime.Now.GetTimeFormatted()
|
MoneyAmount = saveLogResult.Cost,
|
||||||
};
|
TimeParkingIn = cardInformation.TimeIn,
|
||||||
printer.DoPrint(printerData);
|
TimeParkingOut = DateTime.Now.GetTimeFormatted()
|
||||||
|
};
|
||||||
|
printer.DoPrint(printerData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: LƯU BẢN GHI LỖI");
|
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} ra | số thẻ : {cardNumber} | lỗi: LƯU BẢN GHI LỖI");
|
||||||
lblStatusInfo.UpdateLabel("LƯU BẢN GHI LỖI", Color.Red);
|
lblStatusInfo.UpdateLabel("LƯU BẢN GHI LỖI", Color.Red);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReadUsePrinterConfig()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool.TryParse(ConfigurationManager.AppSettings[AppConstant.USE_PRINTER], out isUsePrinter);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Util.UpsertAppSettings(AppConstant.USE_PRINTER, "false");
|
||||||
|
appLogger.Log(LogLevel.Error, $"Không thể đọc cấu hình: {AppConstant.USE_PRINTER}. ex: {ex.Message }");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
|
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
|
||||||
{
|
{
|
||||||
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
|
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
|
||||||
@@ -161,17 +189,23 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
private void OpenDoor(int doorId)
|
private void OpenDoor(int doorId)
|
||||||
{
|
{
|
||||||
if (doorControlAccess.OpenDoor(doorId).HasError)
|
var openDoorResult = doorControlAccess.OpenDoor(doorId);
|
||||||
|
if (openDoorResult.HasError)
|
||||||
{
|
{
|
||||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
|
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
|
||||||
|
appLogger.Log(LogLevel.Error, $"Không thể mở cửa {doorId}. Lỗi: {openDoorResult.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
||||||
{
|
{
|
||||||
|
var starTime = DateTime.Now;
|
||||||
|
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
|
||||||
|
Rect roiBoxRect = Util.ConvertRectangleToRect(pictureBoxRoi, pictureBoxPlateVideo);
|
||||||
|
Mat frameRoi = frame[roiBoxRect];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
|
|
||||||
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
||||||
|
|
||||||
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
||||||
@@ -181,6 +215,7 @@ namespace AIParkingApplication
|
|||||||
overviewCamera.RequestCaptureOneFrame();
|
overviewCamera.RequestCaptureOneFrame();
|
||||||
finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
finalPlateResult = await plateProcessor.ProcessPlate(frame);
|
||||||
}
|
}
|
||||||
|
appLogger.Log(LogLevel.Info, $"ProcessFrameImage: {(DateTime.Now - starTime).TotalMilliseconds} ms");
|
||||||
return finalPlateResult;
|
return finalPlateResult;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -291,5 +326,44 @@ namespace AIParkingApplication
|
|||||||
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
||||||
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
StartPoint = e.Location;
|
||||||
|
pictureBoxRoi = new Rectangle(StartPoint, new System.Drawing.Size(0, 0));
|
||||||
|
IsDrawBox = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (IsDrawBox)
|
||||||
|
{
|
||||||
|
CurrentCursorPosition = e.Location;
|
||||||
|
pictureBoxRoi.Width = CurrentCursorPosition.X - StartPoint.X;
|
||||||
|
pictureBoxRoi.Height = CurrentCursorPosition.Y - StartPoint.Y;
|
||||||
|
}
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_MouseUp(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
IsDrawBox = false;
|
||||||
|
if (StartPoint.X + pictureBoxRoi.Width > pictureBoxPlateVideo.Width || StartPoint.Y + pictureBoxRoi.Height > pictureBoxPlateVideo.Height)
|
||||||
|
{
|
||||||
|
pictureBoxRoi.X = pictureBoxRoi.Y = 0;
|
||||||
|
pictureBoxRoi.Width = pictureBoxPlateVideo.Width;
|
||||||
|
pictureBoxRoi.Height = pictureBoxPlateVideo.Height;
|
||||||
|
}
|
||||||
|
apiController.SaveRoiToServer(pictureBoxRoi, cameraId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxPlateVideo_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Pen redPen = new Pen(Color.FromArgb(255, 255, 0, 0), 3);
|
||||||
|
e.Graphics.DrawRectangle(redPen, pictureBoxRoi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,12 @@
|
|||||||
<metadata name="pictureBoxPlateImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="pictureBoxPlateImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="pictureBoxOverviewImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="pictureBoxPlateImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="grbCardInformation.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="grbCardInformation.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
@@ -147,6 +153,24 @@
|
|||||||
<metadata name="lblCardNumber.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="lblCardNumber.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="lblCardType.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblCardTimeOut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblCardTime.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblMoneyAmount.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblPlateString.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="lblCardNumber.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="pictureBoxPlateImage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="pictureBoxPlateImage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
40
AIParkingApplication/LoginForm.Designer.cs
generated
40
AIParkingApplication/LoginForm.Designer.cs
generated
@@ -37,8 +37,8 @@
|
|||||||
this.txtServerAddress = new System.Windows.Forms.TextBox();
|
this.txtServerAddress = new System.Windows.Forms.TextBox();
|
||||||
this.lblServerAddress = new System.Windows.Forms.Label();
|
this.lblServerAddress = new System.Windows.Forms.Label();
|
||||||
this.btnLogin = new System.Windows.Forms.Button();
|
this.btnLogin = new System.Windows.Forms.Button();
|
||||||
this.btnExit = new System.Windows.Forms.Button();
|
|
||||||
this.lblLoginStatus = new System.Windows.Forms.Label();
|
this.lblLoginStatus = new System.Windows.Forms.Label();
|
||||||
|
this.chkAutoLogin = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxImageLogo)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxImageLogo)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
//
|
//
|
||||||
// txtPassword
|
// txtPassword
|
||||||
//
|
//
|
||||||
this.txtPassword.Location = new System.Drawing.Point(294, 52);
|
this.txtPassword.Location = new System.Drawing.Point(294, 45);
|
||||||
this.txtPassword.Name = "txtPassword";
|
this.txtPassword.Name = "txtPassword";
|
||||||
this.txtPassword.PasswordChar = '*';
|
this.txtPassword.PasswordChar = '*';
|
||||||
this.txtPassword.Size = new System.Drawing.Size(227, 20);
|
this.txtPassword.Size = new System.Drawing.Size(227, 20);
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
// lblPassword
|
// lblPassword
|
||||||
//
|
//
|
||||||
this.lblPassword.AutoSize = true;
|
this.lblPassword.AutoSize = true;
|
||||||
this.lblPassword.Location = new System.Drawing.Point(214, 55);
|
this.lblPassword.Location = new System.Drawing.Point(214, 48);
|
||||||
this.lblPassword.Name = "lblPassword";
|
this.lblPassword.Name = "lblPassword";
|
||||||
this.lblPassword.Size = new System.Drawing.Size(52, 13);
|
this.lblPassword.Size = new System.Drawing.Size(52, 13);
|
||||||
this.lblPassword.TabIndex = 2;
|
this.lblPassword.TabIndex = 2;
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
//
|
//
|
||||||
// txtServerAddress
|
// txtServerAddress
|
||||||
//
|
//
|
||||||
this.txtServerAddress.Location = new System.Drawing.Point(294, 90);
|
this.txtServerAddress.Location = new System.Drawing.Point(294, 77);
|
||||||
this.txtServerAddress.Name = "txtServerAddress";
|
this.txtServerAddress.Name = "txtServerAddress";
|
||||||
this.txtServerAddress.Size = new System.Drawing.Size(227, 20);
|
this.txtServerAddress.Size = new System.Drawing.Size(227, 20);
|
||||||
this.txtServerAddress.TabIndex = 1;
|
this.txtServerAddress.TabIndex = 1;
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
// lblServerAddress
|
// lblServerAddress
|
||||||
//
|
//
|
||||||
this.lblServerAddress.AutoSize = true;
|
this.lblServerAddress.AutoSize = true;
|
||||||
this.lblServerAddress.Location = new System.Drawing.Point(214, 93);
|
this.lblServerAddress.Location = new System.Drawing.Point(214, 80);
|
||||||
this.lblServerAddress.Name = "lblServerAddress";
|
this.lblServerAddress.Name = "lblServerAddress";
|
||||||
this.lblServerAddress.Size = new System.Drawing.Size(48, 13);
|
this.lblServerAddress.Size = new System.Drawing.Size(48, 13);
|
||||||
this.lblServerAddress.TabIndex = 2;
|
this.lblServerAddress.TabIndex = 2;
|
||||||
@@ -105,42 +105,44 @@
|
|||||||
//
|
//
|
||||||
// btnLogin
|
// btnLogin
|
||||||
//
|
//
|
||||||
|
this.btnLogin.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.btnLogin.Location = new System.Drawing.Point(294, 162);
|
this.btnLogin.Location = new System.Drawing.Point(294, 162);
|
||||||
this.btnLogin.Name = "btnLogin";
|
this.btnLogin.Name = "btnLogin";
|
||||||
this.btnLogin.Size = new System.Drawing.Size(101, 37);
|
this.btnLogin.Size = new System.Drawing.Size(227, 37);
|
||||||
this.btnLogin.TabIndex = 3;
|
this.btnLogin.TabIndex = 3;
|
||||||
this.btnLogin.Text = "Đăng nhập";
|
this.btnLogin.Text = "Đăng nhập";
|
||||||
this.btnLogin.UseVisualStyleBackColor = true;
|
this.btnLogin.UseVisualStyleBackColor = true;
|
||||||
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
|
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
|
||||||
//
|
//
|
||||||
// btnExit
|
|
||||||
//
|
|
||||||
this.btnExit.Location = new System.Drawing.Point(421, 162);
|
|
||||||
this.btnExit.Name = "btnExit";
|
|
||||||
this.btnExit.Size = new System.Drawing.Size(101, 37);
|
|
||||||
this.btnExit.TabIndex = 3;
|
|
||||||
this.btnExit.Text = "Thoát";
|
|
||||||
this.btnExit.UseVisualStyleBackColor = true;
|
|
||||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
|
||||||
//
|
|
||||||
// lblLoginStatus
|
// lblLoginStatus
|
||||||
//
|
//
|
||||||
this.lblLoginStatus.AutoSize = true;
|
this.lblLoginStatus.AutoSize = true;
|
||||||
this.lblLoginStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.lblLoginStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.lblLoginStatus.ForeColor = System.Drawing.SystemColors.ControlLight;
|
this.lblLoginStatus.ForeColor = System.Drawing.SystemColors.ControlLight;
|
||||||
this.lblLoginStatus.Location = new System.Drawing.Point(294, 117);
|
this.lblLoginStatus.Location = new System.Drawing.Point(291, 100);
|
||||||
this.lblLoginStatus.Name = "lblLoginStatus";
|
this.lblLoginStatus.Name = "lblLoginStatus";
|
||||||
this.lblLoginStatus.Size = new System.Drawing.Size(90, 18);
|
this.lblLoginStatus.Size = new System.Drawing.Size(90, 18);
|
||||||
this.lblLoginStatus.TabIndex = 4;
|
this.lblLoginStatus.TabIndex = 4;
|
||||||
this.lblLoginStatus.Text = "Login Status";
|
this.lblLoginStatus.Text = "Login Status";
|
||||||
//
|
//
|
||||||
|
// chkAutoLogin
|
||||||
|
//
|
||||||
|
this.chkAutoLogin.AutoSize = true;
|
||||||
|
this.chkAutoLogin.Location = new System.Drawing.Point(295, 142);
|
||||||
|
this.chkAutoLogin.Name = "chkAutoLogin";
|
||||||
|
this.chkAutoLogin.Size = new System.Drawing.Size(122, 17);
|
||||||
|
this.chkAutoLogin.TabIndex = 5;
|
||||||
|
this.chkAutoLogin.Text = "Tự động đăng nhập";
|
||||||
|
this.chkAutoLogin.UseVisualStyleBackColor = true;
|
||||||
|
this.chkAutoLogin.CheckedChanged += new System.EventHandler(this.chkAutoLogin_CheckedChanged);
|
||||||
|
//
|
||||||
// LoginForm
|
// LoginForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(534, 211);
|
this.ClientSize = new System.Drawing.Size(534, 211);
|
||||||
|
this.Controls.Add(this.chkAutoLogin);
|
||||||
this.Controls.Add(this.lblLoginStatus);
|
this.Controls.Add(this.lblLoginStatus);
|
||||||
this.Controls.Add(this.btnExit);
|
|
||||||
this.Controls.Add(this.btnLogin);
|
this.Controls.Add(this.btnLogin);
|
||||||
this.Controls.Add(this.lblServerAddress);
|
this.Controls.Add(this.lblServerAddress);
|
||||||
this.Controls.Add(this.lblPassword);
|
this.Controls.Add(this.lblPassword);
|
||||||
@@ -173,7 +175,7 @@
|
|||||||
private System.Windows.Forms.TextBox txtServerAddress;
|
private System.Windows.Forms.TextBox txtServerAddress;
|
||||||
private System.Windows.Forms.Label lblServerAddress;
|
private System.Windows.Forms.Label lblServerAddress;
|
||||||
private System.Windows.Forms.Button btnLogin;
|
private System.Windows.Forms.Button btnLogin;
|
||||||
private System.Windows.Forms.Button btnExit;
|
|
||||||
private System.Windows.Forms.Label lblLoginStatus;
|
private System.Windows.Forms.Label lblLoginStatus;
|
||||||
|
private System.Windows.Forms.CheckBox chkAutoLogin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,15 +11,18 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
private Logger applicationLogger;
|
private Logger applicationLogger;
|
||||||
|
private bool isAutoLogin;
|
||||||
|
|
||||||
public LoginForm()
|
public LoginForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
applicationLogger = LogManager.GetLogger(AppConstant.APPLICATION_LOGGER_NAME);
|
applicationLogger = LogManager.GetLogger(AppConstant.APPLICATION_LOGGER_NAME);
|
||||||
applicationLogger.Log(LogLevel.Info, new string('-', 20));
|
applicationLogger.Log(LogLevel.Info, new string('-', 20));
|
||||||
if (File.Exists(AppConstant.DEFAULT_LOGO_IMAGE))
|
isAutoLogin = false;
|
||||||
|
string defaultLogoImagePath = Application.StartupPath + AppConstant.DEFAULT_LOGO_IMAGE;
|
||||||
|
if (File.Exists(defaultLogoImagePath))
|
||||||
{
|
{
|
||||||
pictureBoxImageLogo.Image = new Bitmap(AppConstant.DEFAULT_LOGO_IMAGE);
|
pictureBoxImageLogo.Image = new Bitmap(defaultLogoImagePath);
|
||||||
}
|
}
|
||||||
txtUsername.Focus();
|
txtUsername.Focus();
|
||||||
lblLoginStatus.Text = string.Empty;
|
lblLoginStatus.Text = string.Empty;
|
||||||
@@ -34,7 +37,7 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
lblLoginStatus.Text = "Địa chỉ server không được để trống! \r\n ví dụ: 192.168.1.2:80";
|
lblLoginStatus.Text = "Địa chỉ server không được để trống! \r\n ví dụ: 192.168.1.2:80";
|
||||||
btnLogin.Enabled = true;
|
btnLogin.Enabled = true;
|
||||||
applicationLogger.Log(LogLevel.Error, "Địa chỉ server không được để trống");
|
applicationLogger.Log(LogLevel.Info, "Địa chỉ server không được để trống");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +47,7 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
lblLoginStatus.Text = "Địa chỉ server không đúng định dạng: \r\n ví dụ: 192.168.1.122:80";
|
lblLoginStatus.Text = "Địa chỉ server không đúng định dạng: \r\n ví dụ: 192.168.1.122:80";
|
||||||
btnLogin.Enabled = true;
|
btnLogin.Enabled = true;
|
||||||
applicationLogger.Log(LogLevel.Error, "Địa chỉ server không đúng định dạng");
|
applicationLogger.Log(LogLevel.Info, "Địa chỉ server không đúng định dạng");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,9 +57,9 @@ namespace AIParkingApplication
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
applicationLogger.Log(LogLevel.Error, $"Cấu máy chủ lỗi - Kiểm tra lại tên máy chủ, kết nối máy chủ! Không thể khởi tạo API Webserver. ex: {ex.Message}");
|
||||||
MessageBox.Show($"Cấu máy chủ lỗi - Kiểm tra lại tên máy chủ, kết nối máy chủ! \r\n {ex.Message}", "Lỗi khởi tạo API!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show($"Cấu máy chủ lỗi - Kiểm tra lại tên máy chủ, kết nối máy chủ! \r\n {ex.Message}", "Lỗi khởi tạo API!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
btnLogin.Enabled = true;
|
btnLogin.Enabled = true;
|
||||||
applicationLogger.Log(LogLevel.Error, "Cấu máy chủ lỗi - Kiểm tra lại tên máy chủ, kết nối máy chủ! Không thể khởi tạo API Webserver");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +70,7 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
lblLoginStatus.Text = "Tên tài khoản hoặc mật khẩu không được để trống";
|
lblLoginStatus.Text = "Tên tài khoản hoặc mật khẩu không được để trống";
|
||||||
btnLogin.Enabled = true;
|
btnLogin.Enabled = true;
|
||||||
applicationLogger.Log(LogLevel.Error, "Tên tài khoản hoặc mật khẩu không được để trống");
|
applicationLogger.Log(LogLevel.Info, "Tên tài khoản hoặc mật khẩu không được để trống");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +82,7 @@ namespace AIParkingApplication
|
|||||||
if (execeptioMessage.Contains("Error converting value"))
|
if (execeptioMessage.Contains("Error converting value"))
|
||||||
{
|
{
|
||||||
lblLoginStatus.UpdateLabel("Sai tên tài khoản hoặc mật khẩu!", Color.Red);
|
lblLoginStatus.UpdateLabel("Sai tên tài khoản hoặc mật khẩu!", Color.Red);
|
||||||
applicationLogger.Log(LogLevel.Error, "Sai tên tài khoản hoặc mật khẩu");
|
applicationLogger.Log(LogLevel.Info, "Sai tên tài khoản hoặc mật khẩu");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +98,9 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
if (loginResult.IsLoginSuccess)
|
if (loginResult.IsLoginSuccess)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("DEFAULT_USERNAME", txtUsername.Text);
|
Util.UpsertAppSettings(AppConstant.DEFAULT_USERNAME, txtUsername.Text);
|
||||||
Util.AddOrUpdateAppSettings("DEFAULT_PASSWORD", txtPassword.Text);
|
Util.UpsertAppSettings(AppConstant.DEFAULT_PASSWORD, txtPassword.Text);
|
||||||
|
Util.UpsertAppSettings(AppConstant.DEFAULT_WEB_SERVER, txtServerAddress.Text);
|
||||||
new AIParkingApplicationForm(apiController, ipAddress, loginResult.LoginData, applicationLogger).Show();
|
new AIParkingApplicationForm(apiController, ipAddress, loginResult.LoginData, applicationLogger).Show();
|
||||||
Hide();
|
Hide();
|
||||||
applicationLogger.Log(LogLevel.Info, $"Đăng nhập thành công với tài khoản: {txtUsername.Text}");
|
applicationLogger.Log(LogLevel.Info, $"Đăng nhập thành công với tài khoản: {txtUsername.Text}");
|
||||||
@@ -108,30 +112,31 @@ namespace AIParkingApplication
|
|||||||
Login();
|
Login();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnExit_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (DialogResult.OK == MessageBox.Show("AIParking - Bạn muốn thoát ứng dụng?", "Cảnh báo!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
|
|
||||||
{
|
|
||||||
applicationLogger.Log(LogLevel.Info, "Login - Thoát ứng dụng");
|
|
||||||
Application.Exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReadAppConfigurationFromFile()
|
private void ReadAppConfigurationFromFile()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
txtUsername.Text = ConfigurationManager.AppSettings["DEFAULT_USERNAME"];
|
txtUsername.Text = ConfigurationManager.AppSettings[AppConstant.DEFAULT_USERNAME];
|
||||||
txtPassword.Text = ConfigurationManager.AppSettings["DEFAULT_PASSWORD"];
|
txtPassword.Text = ConfigurationManager.AppSettings[AppConstant.DEFAULT_PASSWORD];
|
||||||
|
txtServerAddress.Text = ConfigurationManager.AppSettings[AppConstant.DEFAULT_WEB_SERVER];
|
||||||
|
bool.TryParse(ConfigurationManager.AppSettings[AppConstant.AUTO_LOGIN], out isAutoLogin);
|
||||||
|
if (isAutoLogin)
|
||||||
|
{
|
||||||
|
chkAutoLogin.Checked = true;
|
||||||
|
Login();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtUsername.Text = string.Empty;
|
txtUsername.Text = string.Empty;
|
||||||
txtPassword.Text = string.Empty;
|
txtPassword.Text = string.Empty;
|
||||||
Util.AddOrUpdateAppSettings("DEFAULT_USERNAME", string.Empty);
|
Util.UpsertAppSettings(AppConstant.DEFAULT_USERNAME, string.Empty);
|
||||||
Util.AddOrUpdateAppSettings("DEFAULT_PASSWORD", string.Empty);
|
Util.UpsertAppSettings(AppConstant.DEFAULT_PASSWORD, string.Empty);
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_LOGIN, "false");
|
||||||
|
Util.UpsertAppSettings(AppConstant.DEFAULT_WEB_SERVER, "127.0.0.1:80");
|
||||||
|
chkAutoLogin.Checked = false;
|
||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
||||||
applicationLogger.Log(LogLevel.Error, "Không thể đọc cấu hình tài khoản mặc định: DEFAULT_USERNAME, DEFAULT_PASSWORD");
|
applicationLogger.Log(LogLevel.Error, $"Không thể đọc cấu hình tài khoản mặc định: {AppConstant.DEFAULT_USERNAME}, {AppConstant.DEFAULT_PASSWORD}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,5 +144,10 @@ namespace AIParkingApplication
|
|||||||
{
|
{
|
||||||
ReadAppConfigurationFromFile();
|
ReadAppConfigurationFromFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void chkAutoLogin_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Util.UpsertAppSettings(AppConstant.AUTO_LOGIN, (sender as CheckBox).Checked.ToString().ToLower());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
@@ -20,7 +21,8 @@ namespace AIParkingApplication
|
|||||||
this.maxSizePlate = maxSizePlate;
|
this.maxSizePlate = maxSizePlate;
|
||||||
this.scaleFactor = scaleFactor;
|
this.scaleFactor = scaleFactor;
|
||||||
this.minNeighbors = minNeighbors;
|
this.minNeighbors = minNeighbors;
|
||||||
plateCascadeClassifier = new CascadeClassifier(this.plateType == PlateType.Square ? PlateDetectorConstant.SQUARE_PLATE_WEIGHT_FILENAME : PlateDetectorConstant.LONG_PLATE_WEIGHT_FILENAME);
|
string plateWeightPath = Application.StartupPath + (this.plateType == PlateType.Square ? PlateDetectorConstant.SQUARE_PLATE_WEIGHT_FILENAME : PlateDetectorConstant.LONG_PLATE_WEIGHT_FILENAME);
|
||||||
|
plateCascadeClassifier = new CascadeClassifier(plateWeightPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
~PlateDetector()
|
~PlateDetector()
|
||||||
@@ -87,8 +89,8 @@ namespace AIParkingApplication
|
|||||||
|
|
||||||
public static class PlateDetectorConstant
|
public static class PlateDetectorConstant
|
||||||
{
|
{
|
||||||
public const string SQUARE_PLATE_WEIGHT_FILENAME = "plate.xml";
|
public const string SQUARE_PLATE_WEIGHT_FILENAME = @".\plate.xml";
|
||||||
public const string LONG_PLATE_WEIGHT_FILENAME = "plateLong.xml";
|
public const string LONG_PLATE_WEIGHT_FILENAME = @".\plateLong.xml";
|
||||||
|
|
||||||
public const double SCALE_FACTOR_DEFAULT_SQUARE_PLATE = 1.03;
|
public const double SCALE_FACTOR_DEFAULT_SQUARE_PLATE = 1.03;
|
||||||
public static int MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE = 2;
|
public static int MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE = 2;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace AIParkingApplication
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"ProcessingString\texMessage:{ex.Message}");
|
Console.WriteLine($"ProcessingString\texMessage:{ex.Message}");
|
||||||
appLogger.Log(LogLevel.Info, $"Lỗi khi In hóa đơn: {ex.Message}");
|
appLogger.Log(LogLevel.Error, $"Lỗi khi In hóa đơn: {ex.Message}");
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
AIParkingApplication/Sidebar.Designer.cs
generated
1
AIParkingApplication/Sidebar.Designer.cs
generated
@@ -36,6 +36,7 @@
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.Name = "Sidebar";
|
this.Name = "Sidebar";
|
||||||
this.Size = new System.Drawing.Size(192, 692);
|
this.Size = new System.Drawing.Size(192, 692);
|
||||||
|
this.Load += new System.EventHandler(this.Sidebar_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,20 @@ namespace AIParkingApplication
|
|||||||
public partial class Sidebar : UserControl
|
public partial class Sidebar : UserControl
|
||||||
{
|
{
|
||||||
private Statistic statistic;
|
private Statistic statistic;
|
||||||
|
private string logoImagePath;
|
||||||
|
private ApiController apiController;
|
||||||
|
|
||||||
public Sidebar(ApiController apiController, string logoImagePath = AppConstant.DEFAULT_LOGO_IMAGE)
|
public Sidebar(ApiController apiController, string logoImagePath = AppConstant.DEFAULT_LOGO_IMAGE)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
if (File.Exists(logoImagePath))
|
this.apiController = apiController;
|
||||||
|
this.logoImagePath = logoImagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Sidebar_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string defaultLogoImagePath = Application.StartupPath + logoImagePath;
|
||||||
|
if (File.Exists(defaultLogoImagePath))
|
||||||
{
|
{
|
||||||
PictureBox pictureBoxImageLogo;
|
PictureBox pictureBoxImageLogo;
|
||||||
pictureBoxImageLogo = new PictureBox();
|
pictureBoxImageLogo = new PictureBox();
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Newtonsoft.Json;
|
using Microsoft.Win32;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using OpenCvSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -7,6 +9,7 @@ using System.IO;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
@@ -113,7 +116,7 @@ namespace AIParkingApplication
|
|||||||
int.TryParse(hostParts[1], out port);
|
int.TryParse(hostParts[1], out port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddOrUpdateAppSettings(string key, string value)
|
public static void UpsertAppSettings(string key, string value)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -135,6 +138,46 @@ namespace AIParkingApplication
|
|||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tAddOrUpdateAppSettings\t{ex.Message}");
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tAddOrUpdateAppSettings\t{ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Rect ConvertRectangleToRect(Rectangle pictureBoxRoi, PictureBox pictureBoxPlateVideo)
|
||||||
|
{
|
||||||
|
Rect temp = new Rect
|
||||||
|
{
|
||||||
|
X = pictureBoxRoi.X * 1280 / pictureBoxPlateVideo.Width,
|
||||||
|
Y = pictureBoxRoi.Y * 720 / pictureBoxPlateVideo.Height,
|
||||||
|
Width = pictureBoxRoi.Width * 1280 / pictureBoxPlateVideo.Width,
|
||||||
|
Height = pictureBoxRoi.Height * 720 / pictureBoxPlateVideo.Height
|
||||||
|
};
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rectangle ConvertStringToRectangle(string input)
|
||||||
|
{
|
||||||
|
var roi = JsonConvert.DeserializeObject<RoiConfig>(input);
|
||||||
|
return new Rectangle
|
||||||
|
{
|
||||||
|
X = roi.X,
|
||||||
|
Y = roi.Y,
|
||||||
|
Height = roi.Height,
|
||||||
|
Width = roi.Width
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddApplicationToStartup()
|
||||||
|
{
|
||||||
|
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
|
||||||
|
{
|
||||||
|
key.SetValue("AIParkingApplication", "\"" + Application.ExecutablePath + "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveApplicationFromStartup()
|
||||||
|
{
|
||||||
|
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
|
||||||
|
{
|
||||||
|
key.DeleteValue("AIParkingApplication", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlateRequestEngineModel
|
public class PlateRequestEngineModel
|
||||||
@@ -165,4 +208,22 @@ namespace AIParkingApplication
|
|||||||
public const string HTTP_POST_METHOD = "POST";
|
public const string HTTP_POST_METHOD = "POST";
|
||||||
public const string HTTP_POST_CONTENTTYPE = "application/json";
|
public const string HTTP_POST_CONTENTTYPE = "application/json";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RoiConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("x")]
|
||||||
|
public int X { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("y")]
|
||||||
|
public int Y { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("width")]
|
||||||
|
public int Width { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("height")]
|
||||||
|
public int Height { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("camera_id")]
|
||||||
|
public string CameraID { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,6 @@
|
|||||||
<package id="OpenCvSharp4" version="4.3.0.20200524" targetFramework="net461" />
|
<package id="OpenCvSharp4" version="4.3.0.20200524" targetFramework="net461" />
|
||||||
<package id="OpenCvSharp4.runtime.win" version="4.3.0.20200524" targetFramework="net461" />
|
<package id="OpenCvSharp4.runtime.win" version="4.3.0.20200524" targetFramework="net461" />
|
||||||
<package id="OpenCvSharp4.Windows" version="4.3.0.20200524" targetFramework="net461" />
|
<package id="OpenCvSharp4.Windows" version="4.3.0.20200524" targetFramework="net461" />
|
||||||
|
<package id="System.Net.Http" version="4.3.4" targetFramework="net461" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user