Compare commits
6 Commits
0375eac88d
...
8778a976db
Author | SHA1 | Date | |
---|---|---|---|
8778a976db | |||
e1f1320671 | |||
0af35e015a | |||
7d2f05a2f8 | |||
d6d87b2ec8 | |||
740858693e |
|
@ -77,6 +77,9 @@
|
||||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.7.2\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
|
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.dll</HintPath>
|
<HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -89,12 +92,16 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
<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>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
@ -120,6 +127,7 @@
|
||||||
<Compile Include="Camera.cs" />
|
<Compile Include="Camera.cs" />
|
||||||
<Compile Include="EngineApiController.cs" />
|
<Compile Include="EngineApiController.cs" />
|
||||||
<Compile Include="Enums.cs" />
|
<Compile Include="Enums.cs" />
|
||||||
|
<Compile Include="ExtensitionMethods.cs" />
|
||||||
<Compile Include="IDoorControlAccess.cs" />
|
<Compile Include="IDoorControlAccess.cs" />
|
||||||
<Compile Include="ILane.cs" />
|
<Compile Include="ILane.cs" />
|
||||||
<Compile Include="LaneIn.cs">
|
<Compile Include="LaneIn.cs">
|
||||||
|
@ -198,6 +206,12 @@
|
||||||
<None Include="engine.bat">
|
<None Include="engine.bat">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<Content Include="NLog.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="NLog.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -8,6 +9,8 @@ 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;
|
||||||
|
@ -20,15 +23,19 @@ namespace AIParkingApplication
|
||||||
private EngineApiController engineApiController;
|
private EngineApiController engineApiController;
|
||||||
private string doorAccessControlDeviceIP;
|
private string doorAccessControlDeviceIP;
|
||||||
|
|
||||||
|
private Logger applicationLogger;
|
||||||
|
|
||||||
public AIParkingApplicationForm(ApiController apiController, string serverIPAddress, Config configOnWeb)
|
public AIParkingApplicationForm(ApiController apiController, string serverIPAddress, Config configOnWeb)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.configOnWeb = configOnWeb;
|
this.configOnWeb = configOnWeb;
|
||||||
|
applicationLogger = LogManager.GetLogger(AppConstant.APPLICATION_LOGGER_NAME);
|
||||||
|
|
||||||
ReadAccessControlDeviceIPConfigurationFile();
|
ReadAccessControlDeviceIPConfigurationFile();
|
||||||
if (string.IsNullOrEmpty(doorAccessControlDeviceIP) || !Util.IsValidIPAddress(doorAccessControlDeviceIP))
|
if (string.IsNullOrEmpty(doorAccessControlDeviceIP) || !Util.IsValidIPAddress(doorAccessControlDeviceIP))
|
||||||
{
|
{
|
||||||
|
applicationLogger.Log(LogLevel.Error, "Kiểm tra lại cấu hình IP thiết bị mở cửa!");
|
||||||
MessageBox.Show("Kiểm tra lại cấu hình IP thiết bị mở cửa! (C3200)", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Kiểm tra lại cấu hình IP thiết bị mở cửa! (C3200)", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +47,7 @@ namespace AIParkingApplication
|
||||||
};
|
};
|
||||||
Controls.Add(sidebar);
|
Controls.Add(sidebar);
|
||||||
|
|
||||||
statusBar = new StatusBar("192.168.1.122", doorAccessControlDeviceIP)
|
statusBar = new StatusBar(serverIPAddress, doorAccessControlDeviceIP)
|
||||||
{
|
{
|
||||||
Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26),
|
Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26),
|
||||||
Anchor = AnchorStyles.Bottom | AnchorStyles.Left
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Left
|
||||||
|
@ -53,6 +60,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
applicationLogger.Log(LogLevel.Error, "Cấu hình URL của Engine nhận diện biển số lỗi!");
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +100,8 @@ namespace AIParkingApplication
|
||||||
laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||||
laneOut34.Show();
|
laneOut34.Show();
|
||||||
laneOut34.Start();
|
laneOut34.Start();
|
||||||
|
|
||||||
|
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLaneInIn()
|
private void UpdateLaneInIn()
|
||||||
|
@ -105,6 +115,8 @@ namespace AIParkingApplication
|
||||||
laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||||
laneIn56.Show();
|
laneIn56.Show();
|
||||||
laneIn56.Start();
|
laneIn56.Start();
|
||||||
|
|
||||||
|
toolStripMenuItemSwitchLaneInIn.DisableSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLaneOutIn()
|
private void UpdateLaneOutIn()
|
||||||
|
@ -118,6 +130,8 @@ namespace AIParkingApplication
|
||||||
laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||||
laneIn56.Show();
|
laneIn56.Show();
|
||||||
laneIn56.Start();
|
laneIn56.Start();
|
||||||
|
|
||||||
|
toolStripMenuItemSwitchLaneOutIn.DisableSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLaneOutOut()
|
private void UpdateLaneOutOut()
|
||||||
|
@ -131,38 +145,44 @@ namespace AIParkingApplication
|
||||||
laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||||
laneOut34.Show();
|
laneOut34.Show();
|
||||||
laneOut34.Start();
|
laneOut34.Start();
|
||||||
|
|
||||||
|
toolStripMenuItemSwitchLaneOutOut.DisableSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-IN");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-IN");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneInIn();
|
UpdateLaneInIn();
|
||||||
|
applicationLogger.Log(LogLevel.Info, "Chuyển làn: IN-IN");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
|
applicationLogger.Log(LogLevel.Info, "Chuyển làn: IN-OUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "OUT-IN");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-IN");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneOutIn();
|
UpdateLaneOutIn();
|
||||||
|
applicationLogger.Log(LogLevel.Info, "Chuyển làn: OUT-IN");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "OUT-OUT");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-OUT");
|
||||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||||
StopAllLanes();
|
StopAllLanes();
|
||||||
UpdateLaneOutOut();
|
UpdateLaneOutOut();
|
||||||
|
applicationLogger.Log(LogLevel.Info, "Chuyển làn: OUT-OUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMenuStripItemStatus(ToolStripMenuItem selectedToolStripMenuItem)
|
private void UpdateMenuStripItemStatus(ToolStripMenuItem selectedToolStripMenuItem)
|
||||||
|
@ -204,7 +224,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string lanesConfig = ConfigurationManager.AppSettings["CURRENT_LANE_SETTING"];
|
string lanesConfig = ConfigurationManager.AppSettings[CURRENT_LANE_SETTING_KEY];
|
||||||
if (!string.IsNullOrEmpty(lanesConfig))
|
if (!string.IsNullOrEmpty(lanesConfig))
|
||||||
{
|
{
|
||||||
string[] lanes = lanesConfig.Split('-');
|
string[] lanes = lanesConfig.Split('-');
|
||||||
|
@ -215,32 +235,38 @@ namespace AIParkingApplication
|
||||||
if (lane0 == "in" && lane1 == "in")
|
if (lane0 == "in" && lane1 == "in")
|
||||||
{
|
{
|
||||||
UpdateLaneInIn();
|
UpdateLaneInIn();
|
||||||
|
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-IN");
|
||||||
}
|
}
|
||||||
if (lane0 == "in" && lane1 == "out")
|
if (lane0 == "in" && lane1 == "out")
|
||||||
{
|
{
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
|
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: IN-OUT");
|
||||||
}
|
}
|
||||||
if (lane0 == "out" && lane1 == "in")
|
if (lane0 == "out" && lane1 == "in")
|
||||||
{
|
{
|
||||||
UpdateLaneOutIn();
|
UpdateLaneOutIn();
|
||||||
|
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-IN");
|
||||||
}
|
}
|
||||||
if (lane0 == "out" && lane1 == "out")
|
if (lane0 == "out" && lane1 == "out")
|
||||||
{
|
{
|
||||||
UpdateLaneOutOut();
|
UpdateLaneOutOut();
|
||||||
|
applicationLogger.Log(LogLevel.Info, $"Khởi động App sử dụng lane: OUT-OUT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
|
applicationLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||||
UpdateLaneInOut();
|
UpdateLaneInOut();
|
||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
||||||
|
applicationLogger.Log(LogLevel.Error, $"Đọc config làn lỗi khi khởi động app!\texMessage: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,8 +278,9 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
|
||||||
doorAccessControlDeviceIP = string.Empty;
|
doorAccessControlDeviceIP = string.Empty;
|
||||||
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
||||||
|
applicationLogger.Log(LogLevel.Error, $"Cấu hình IP thiết bị mở cửa lỗi(DOOR_ACCESS_DEVICE_CONTROL_IP)!\texMessage: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +292,7 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
applicationLogger.Log(LogLevel.Error, $"Đóng ứng dụng");
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
{
|
{
|
||||||
public static class AppConstant
|
public static class AppConstant
|
||||||
{
|
{
|
||||||
#region Application Messages
|
|
||||||
public const string APPLICATION_IS_RUNNNING = "AIParkingApplication: Ứng dụng đã chạy!";
|
public const string APPLICATION_IS_RUNNNING = "AIParkingApplication: Ứng dụng đã chạy!";
|
||||||
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";
|
||||||
#endregion
|
|
||||||
|
|
||||||
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 PING_SERVER_LOGGER_NAME = "PingServerLogger";
|
||||||
|
public const string PING_DOOR_DEVICE_CONTROL_ACCESS_LOGGER_NAME = "PingDoorDeviceControlAccessLogger";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
76
AIParkingApplication/ExtensitionMethods.cs
Normal file
76
AIParkingApplication/ExtensitionMethods.cs
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AIParkingApplication
|
||||||
|
{
|
||||||
|
public static class ExtensitionMethods
|
||||||
|
{
|
||||||
|
public static void DisableSelected(this ToolStripMenuItem toolStripMenuItem)
|
||||||
|
{
|
||||||
|
toolStripMenuItem.Checked = true;
|
||||||
|
toolStripMenuItem.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetTimeFormatted(this DateTime dateTime)
|
||||||
|
{
|
||||||
|
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
||||||
|
{
|
||||||
|
if (pictureBox.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pictureBox.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
pictureBox.Image?.Dispose();
|
||||||
|
pictureBox.Image = image;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
||||||
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
label.Text = text;
|
||||||
|
label.BackColor = backColor;
|
||||||
|
label.ForeColor = foreColor;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateLabel(this Label label, string text, Color backColor)
|
||||||
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
label.Text = text;
|
||||||
|
label.BackColor = backColor;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateLabel(this Label label, string text)
|
||||||
|
{
|
||||||
|
if (label.IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
label.Text = text;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
AIParkingApplication/NLog.config
Normal file
33
AIParkingApplication/NLog.config
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="D:\nlog-internal.log">
|
||||||
|
<variable name="logDirectory" value="${basedir}/logs"/>
|
||||||
|
<targets>
|
||||||
|
<target xsi:type="File" name="applicationLogger" fileName="${logDirectory}/${shortdate}_App.log"
|
||||||
|
layout="${uppercase:${level}} ${message} ${exception}"
|
||||||
|
maxArchiveFiles="30"
|
||||||
|
encoding="Unicode"
|
||||||
|
writeBom="true"/>
|
||||||
|
|
||||||
|
<target xsi:type="File" name="pingServerLoggingFile" fileName="${logDirectory}/${shortdate}_PingServer.log"
|
||||||
|
layout="${uppercase:${level}} ${message} ${exception}"
|
||||||
|
maxArchiveFiles="30"
|
||||||
|
encoding="Unicode"
|
||||||
|
writeBom="true"/>
|
||||||
|
|
||||||
|
<target xsi:type="File" name="pingDoorDeviceControlAccessLoggingFile" fileName="${logDirectory}/${shortdate}_PingDoorDeviceControlAccess.log"
|
||||||
|
layout="${uppercase:${level}} ${message} ${exception}"
|
||||||
|
maxArchiveFiles="30"
|
||||||
|
encoding="Unicode"
|
||||||
|
writeBom="true"/>
|
||||||
|
</targets>
|
||||||
|
<rules>
|
||||||
|
<logger name="ApplicationLogger" minlevel="Trace" writeTo="applicationLogger" />
|
||||||
|
<logger name="PingServerLogger" minlevel="Trace" writeTo="pingServerLoggingFile" />
|
||||||
|
<logger name="PingDoorDeviceControlAccessLogger" minlevel="Trace" writeTo="pingDoorDeviceControlAccessLoggingFile" />
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
3638
AIParkingApplication/NLog.xsd
Normal file
3638
AIParkingApplication/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -6,9 +6,7 @@ using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
|
@ -54,62 +52,6 @@ namespace AIParkingApplication
|
||||||
return sf.GetMethod().Name;
|
return sf.GetMethod().Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
|
||||||
{
|
|
||||||
if (pictureBox.IsDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pictureBox.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
pictureBox.Image?.Dispose();
|
|
||||||
pictureBox.Image = image;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
|
||||||
{
|
|
||||||
if (label.IsDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
label.Text = text;
|
|
||||||
label.BackColor = backColor;
|
|
||||||
label.ForeColor = foreColor;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text, Color backColor)
|
|
||||||
{
|
|
||||||
if (label.IsDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
label.Text = text;
|
|
||||||
label.BackColor = backColor;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void UpdateLabel(this Label label, string text)
|
|
||||||
{
|
|
||||||
if (label.IsDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
label.Text = text;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Bitmap ConvertFromBase64Image(string base64ImageString)
|
public static Bitmap ConvertFromBase64Image(string base64ImageString)
|
||||||
{
|
{
|
||||||
byte[] imageData = Convert.FromBase64String(base64ImageString);
|
byte[] imageData = Convert.FromBase64String(base64ImageString);
|
||||||
|
@ -120,11 +62,6 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetTimeFormatted(this DateTime dateTime)
|
|
||||||
{
|
|
||||||
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ExecuteCommand(string command)
|
public static void ExecuteCommand(string command)
|
||||||
{
|
{
|
||||||
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
|
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net461" />
|
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net461" />
|
||||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||||
|
<package id="NLog" version="4.7.2" targetFramework="net461" />
|
||||||
|
<package id="NLog.Config" version="4.7.2" targetFramework="net461" />
|
||||||
|
<package id="NLog.Schema" version="4.7.2" targetFramework="net461" />
|
||||||
<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" />
|
||||||
|
|
BIN
packages/NLog.4.7.2/.signature.p7s
vendored
Normal file
BIN
packages/NLog.4.7.2/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/NLog.4.7.2/lib/monoandroid44/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/monoandroid44/NLog.dll
vendored
Normal file
Binary file not shown.
26661
packages/NLog.4.7.2/lib/monoandroid44/NLog.xml
vendored
Normal file
26661
packages/NLog.4.7.2/lib/monoandroid44/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/net35/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/net35/NLog.dll
vendored
Normal file
Binary file not shown.
29160
packages/NLog.4.7.2/lib/net35/NLog.xml
vendored
Normal file
29160
packages/NLog.4.7.2/lib/net35/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/net40-client/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/net40-client/NLog.dll
vendored
Normal file
Binary file not shown.
29391
packages/NLog.4.7.2/lib/net40-client/NLog.xml
vendored
Normal file
29391
packages/NLog.4.7.2/lib/net40-client/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/net45/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/net45/NLog.dll
vendored
Normal file
Binary file not shown.
29589
packages/NLog.4.7.2/lib/net45/NLog.xml
vendored
Normal file
29589
packages/NLog.4.7.2/lib/net45/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/netstandard1.3/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/netstandard1.3/NLog.dll
vendored
Normal file
Binary file not shown.
25730
packages/NLog.4.7.2/lib/netstandard1.3/NLog.xml
vendored
Normal file
25730
packages/NLog.4.7.2/lib/netstandard1.3/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/netstandard1.5/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/netstandard1.5/NLog.dll
vendored
Normal file
Binary file not shown.
26729
packages/NLog.4.7.2/lib/netstandard1.5/NLog.xml
vendored
Normal file
26729
packages/NLog.4.7.2/lib/netstandard1.5/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/netstandard2.0/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/netstandard2.0/NLog.dll
vendored
Normal file
Binary file not shown.
27537
packages/NLog.4.7.2/lib/netstandard2.0/NLog.xml
vendored
Normal file
27537
packages/NLog.4.7.2/lib/netstandard2.0/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/sl4/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/sl4/NLog.dll
vendored
Normal file
Binary file not shown.
21873
packages/NLog.4.7.2/lib/sl4/NLog.xml
vendored
Normal file
21873
packages/NLog.4.7.2/lib/sl4/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/sl5/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/sl5/NLog.dll
vendored
Normal file
Binary file not shown.
22039
packages/NLog.4.7.2/lib/sl5/NLog.xml
vendored
Normal file
22039
packages/NLog.4.7.2/lib/sl5/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/wp8/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/wp8/NLog.dll
vendored
Normal file
Binary file not shown.
21215
packages/NLog.4.7.2/lib/wp8/NLog.xml
vendored
Normal file
21215
packages/NLog.4.7.2/lib/wp8/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.4.7.2/lib/xamarinios10/NLog.dll
vendored
Normal file
BIN
packages/NLog.4.7.2/lib/xamarinios10/NLog.dll
vendored
Normal file
Binary file not shown.
26607
packages/NLog.4.7.2/lib/xamarinios10/NLog.xml
vendored
Normal file
26607
packages/NLog.4.7.2/lib/xamarinios10/NLog.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/NLog.Config.4.7.2/.signature.p7s
vendored
Normal file
BIN
packages/NLog.Config.4.7.2/.signature.p7s
vendored
Normal file
Binary file not shown.
41
packages/NLog.Config.4.7.2/content/NLog.config
vendored
Normal file
41
packages/NLog.Config.4.7.2/content/NLog.config
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||||
|
|
||||||
|
<!-- optional, add some variables
|
||||||
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||||
|
-->
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||||
|
for information on customizing logging rules and outputs.
|
||||||
|
-->
|
||||||
|
<targets>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
add your targets here
|
||||||
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||||
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write events to a file with the date in the filename.
|
||||||
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
-->
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- add your logging rules here -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
41
packages/NLog.Config.4.7.2/contentFiles/any/any/NLog.config
vendored
Normal file
41
packages/NLog.Config.4.7.2/contentFiles/any/any/NLog.config
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||||
|
|
||||||
|
<!-- optional, add some variables
|
||||||
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||||
|
-->
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||||
|
for information on customizing logging rules and outputs.
|
||||||
|
-->
|
||||||
|
<targets>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
add your targets here
|
||||||
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||||
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write events to a file with the date in the filename.
|
||||||
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
-->
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- add your logging rules here -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
12
packages/NLog.Config.4.7.2/tools/Install.ps1
vendored
Normal file
12
packages/NLog.Config.4.7.2/tools/Install.ps1
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
param($installPath, $toolsPath, $package, $project)
|
||||||
|
|
||||||
|
$configItem = $project.ProjectItems.Item("NLog.config")
|
||||||
|
|
||||||
|
# set 'Copy To Output Directory' to 'Copy if newer'
|
||||||
|
$copyToOutput = $configItem.Properties.Item("CopyToOutputDirectory")
|
||||||
|
$copyToOutput.Value = 2
|
||||||
|
|
||||||
|
# set 'Build Action' to 'Content'
|
||||||
|
$buildAction = $configItem.Properties.Item("BuildAction")
|
||||||
|
$buildAction.Value = 2
|
||||||
|
|
BIN
packages/NLog.Schema.4.7.2/.signature.p7s
vendored
Normal file
BIN
packages/NLog.Schema.4.7.2/.signature.p7s
vendored
Normal file
Binary file not shown.
3638
packages/NLog.Schema.4.7.2/content/NLog.xsd
vendored
Normal file
3638
packages/NLog.Schema.4.7.2/content/NLog.xsd
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3638
packages/NLog.Schema.4.7.2/contentFiles/any/any/NLog.xsd
vendored
Normal file
3638
packages/NLog.Schema.4.7.2/contentFiles/any/any/NLog.xsd
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user