Compare commits
2 Commits
59208674e0
...
d97908a22b
Author | SHA1 | Date | |
---|---|---|---|
d97908a22b | |||
9400402141 |
|
@ -9,8 +9,6 @@ namespace AIParkingApplication
|
|||
{
|
||||
public partial class AIParkingApplicationForm : Form
|
||||
{
|
||||
private const string CURRENT_LANE_SETTING_KEY = "CURRENT_LANE_SETTING";
|
||||
|
||||
private ApiController apiController;
|
||||
private IDoorControlAccess c3Device;
|
||||
private LaneIn laneIn12;
|
||||
|
@ -154,7 +152,7 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "IN-IN");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-IN");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInIn();
|
||||
|
@ -163,7 +161,7 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInOut();
|
||||
|
@ -172,7 +170,7 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-IN");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "OUT-IN");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutIn();
|
||||
|
@ -181,7 +179,7 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "OUT-OUT");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "OUT-OUT");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutOut();
|
||||
|
@ -227,7 +225,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
try
|
||||
{
|
||||
string lanesConfig = ConfigurationManager.AppSettings[CURRENT_LANE_SETTING_KEY];
|
||||
string lanesConfig = ConfigurationManager.AppSettings[AppConstant.CURRENT_LANE_SETTING];
|
||||
if (!string.IsNullOrEmpty(lanesConfig))
|
||||
{
|
||||
string[] lanes = lanesConfig.Split('-');
|
||||
|
@ -262,7 +260,7 @@ namespace AIParkingApplication
|
|||
}
|
||||
else
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||
appLogger.Log(LogLevel.Info, $"Khởi động App đọc config không đủ 2 param: IN-OUT");
|
||||
|
@ -271,7 +269,7 @@ namespace AIParkingApplication
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.UpsertAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||
Util.UpsertAppSettings(AppConstant.CURRENT_LANE_SETTING, "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
||||
|
@ -283,13 +281,13 @@ namespace AIParkingApplication
|
|||
{
|
||||
try
|
||||
{
|
||||
doorAccessControlDeviceIP = ConfigurationManager.AppSettings["DOOR_ACCESS_DEVICE_CONTROL_IP"].Trim();
|
||||
doorAccessControlDeviceIP = ConfigurationManager.AppSettings[AppConstant.DOOR_ACCESS_DEVICE_CONTROL_IP].Trim();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
doorAccessControlDeviceIP = string.Empty;
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,25 @@
|
|||
public const string ERROR_TITLE = "Lỗi";
|
||||
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 APPLICATION_LOGGER_NAME = "ApplicationLogger";
|
||||
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 System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
|
@ -50,7 +51,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ namespace AIParkingApplication
|
|||
}
|
||||
else
|
||||
{
|
||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(Application.StartupPath + AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
21
AIParkingApplication/ConfigurationForm.Designer.cs
generated
21
AIParkingApplication/ConfigurationForm.Designer.cs
generated
|
@ -28,7 +28,7 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtDoorDeviceControlAccessIPStatus = new System.Windows.Forms.Label();
|
||||
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();
|
||||
|
@ -50,14 +50,14 @@
|
|||
this.statusStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtDoorDeviceControlAccessIPStatus
|
||||
// lblDoorDeviceControlAccessIPStatus
|
||||
//
|
||||
this.txtDoorDeviceControlAccessIPStatus.AutoSize = true;
|
||||
this.txtDoorDeviceControlAccessIPStatus.Location = new System.Drawing.Point(412, 9);
|
||||
this.txtDoorDeviceControlAccessIPStatus.Name = "txtDoorDeviceControlAccessIPStatus";
|
||||
this.txtDoorDeviceControlAccessIPStatus.Size = new System.Drawing.Size(58, 13);
|
||||
this.txtDoorDeviceControlAccessIPStatus.TabIndex = 17;
|
||||
this.txtDoorDeviceControlAccessIPStatus.Text = "Trạng thái:";
|
||||
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
|
||||
//
|
||||
|
@ -67,6 +67,7 @@
|
|||
this.btnCheckDoorDeviceControlAccessIP.TabIndex = 2;
|
||||
this.btnCheckDoorDeviceControlAccessIP.Text = "Kiểm tra";
|
||||
this.btnCheckDoorDeviceControlAccessIP.UseVisualStyleBackColor = true;
|
||||
this.btnCheckDoorDeviceControlAccessIP.Click += new System.EventHandler(this.btnCheckDoorDeviceControlAccessIP_Click);
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
|
@ -233,7 +234,7 @@
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(646, 281);
|
||||
this.Controls.Add(this.statusStrip);
|
||||
this.Controls.Add(this.txtDoorDeviceControlAccessIPStatus);
|
||||
this.Controls.Add(this.lblDoorDeviceControlAccessIPStatus);
|
||||
this.Controls.Add(this.btnCheckDoorDeviceControlAccessIP);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.btnSaveSettings);
|
||||
|
@ -266,7 +267,7 @@
|
|||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label txtDoorDeviceControlAccessIPStatus;
|
||||
private System.Windows.Forms.Label lblDoorDeviceControlAccessIPStatus;
|
||||
private System.Windows.Forms.Button btnCheckDoorDeviceControlAccessIP;
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.Button btnSaveSettings;
|
||||
|
|
|
@ -29,13 +29,19 @@ namespace AIParkingApplication
|
|||
|
||||
private void btnSaveSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings("DOOR_ACCESS_DEVICE_CONTROL_IP", txtDoorDeviceControlAccessIP.Text);
|
||||
Util.UpsertAppSettings("AUTO_OPEN_DOOR_1", chkAllowAutoDoor1.Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings("AUTO_OPEN_DOOR_2", chkAllowAutoDoor2.Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings("USE_PRINTER", chkAllowUsePrinter.Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings("ALLOW_CHANGE_ROI_RECT", chkAllowChangeROIRect.Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings("AUTO_LOGIN", chkAllowAutoLogin.Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings("AUTO_RUN_AT_STARTUP", chkAllowAutoRunAtStartUp.Checked.ToString().ToLower());
|
||||
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();
|
||||
|
@ -61,13 +67,13 @@ namespace AIParkingApplication
|
|||
|
||||
private void LoadConfiguration()
|
||||
{
|
||||
doorAccessControlDeviceIP = ReadConfigurationFromAppSettings("DOOR_ACCESS_DEVICE_CONTROL_IP", string.Empty);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("AUTO_OPEN_DOOR_1", "false"), out allowAutoOpenDoor1);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("AUTO_OPEN_DOOR_2", "false"), out allowAutoOpenDoor2);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("USE_PRINTER", "false"), out allowUsePrinter);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("ALLOW_CHANGE_ROI_RECT", "false"), out allowChangeROIRect);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("AUTO_LOGIN", "false"), out allowAutoLogin);
|
||||
bool.TryParse(ReadConfigurationFromAppSettings("AUTO_RUN_AT_STARTUP", "false"), out allowAutoRunAtStartUp);
|
||||
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)
|
||||
|
@ -84,5 +90,19 @@ namespace AIParkingApplication
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,12 +156,12 @@ namespace AIParkingApplication
|
|||
{
|
||||
try
|
||||
{
|
||||
bool.TryParse(ConfigurationManager.AppSettings["USE_PRINTER"], out isUsePrinter);
|
||||
bool.TryParse(ConfigurationManager.AppSettings[AppConstant.USE_PRINTER], out isUsePrinter);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.UpsertAppSettings("USE_PRINTER", "false");
|
||||
appLogger.Log(LogLevel.Error, $"Không thể đọc cấu hình: USE_PRINTER. ex: {ex.Message }");
|
||||
Util.UpsertAppSettings(AppConstant.USE_PRINTER, "false");
|
||||
appLogger.Log(LogLevel.Error, $"Không thể đọc cấu hình: {AppConstant.USE_PRINTER}. ex: {ex.Message }");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ using System;
|
|||
using System.Configuration;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
|
@ -20,9 +19,10 @@ namespace AIParkingApplication
|
|||
applicationLogger = LogManager.GetLogger(AppConstant.APPLICATION_LOGGER_NAME);
|
||||
applicationLogger.Log(LogLevel.Info, new string('-', 20));
|
||||
isAutoLogin = false;
|
||||
if (File.Exists(AppConstant.DEFAULT_LOGO_IMAGE))
|
||||
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();
|
||||
lblLoginStatus.Text = string.Empty;
|
||||
|
@ -98,9 +98,9 @@ namespace AIParkingApplication
|
|||
|
||||
if (loginResult.IsLoginSuccess)
|
||||
{
|
||||
Util.UpsertAppSettings("DEFAULT_USERNAME", txtUsername.Text);
|
||||
Util.UpsertAppSettings("DEFAULT_PASSWORD", txtPassword.Text);
|
||||
Util.UpsertAppSettings("DEFAULT_WEB_SERVER", txtServerAddress.Text);
|
||||
Util.UpsertAppSettings(AppConstant.DEFAULT_USERNAME, txtUsername.Text);
|
||||
Util.UpsertAppSettings(AppConstant.DEFAULT_PASSWORD, txtPassword.Text);
|
||||
Util.UpsertAppSettings(AppConstant.DEFAULT_WEB_SERVER, txtServerAddress.Text);
|
||||
new AIParkingApplicationForm(apiController, ipAddress, loginResult.LoginData, applicationLogger).Show();
|
||||
Hide();
|
||||
applicationLogger.Log(LogLevel.Info, $"Đăng nhập thành công với tài khoản: {txtUsername.Text}");
|
||||
|
@ -116,10 +116,10 @@ namespace AIParkingApplication
|
|||
{
|
||||
try
|
||||
{
|
||||
txtUsername.Text = ConfigurationManager.AppSettings["DEFAULT_USERNAME"];
|
||||
txtPassword.Text = ConfigurationManager.AppSettings["DEFAULT_PASSWORD"];
|
||||
txtServerAddress.Text = ConfigurationManager.AppSettings["DEFAULT_WEB_SERVER"];
|
||||
bool.TryParse(ConfigurationManager.AppSettings["AUTO_LOGIN"], out isAutoLogin);
|
||||
txtUsername.Text = ConfigurationManager.AppSettings[AppConstant.DEFAULT_USERNAME];
|
||||
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;
|
||||
|
@ -130,13 +130,13 @@ namespace AIParkingApplication
|
|||
{
|
||||
txtUsername.Text = string.Empty;
|
||||
txtPassword.Text = string.Empty;
|
||||
Util.UpsertAppSettings("DEFAULT_USERNAME", string.Empty);
|
||||
Util.UpsertAppSettings("DEFAULT_PASSWORD", string.Empty);
|
||||
Util.UpsertAppSettings("AUTO_LOGIN", "false");
|
||||
Util.UpsertAppSettings("DEFAULT_WEB_SERVER", "127.0.0.1:80");
|
||||
Util.UpsertAppSettings(AppConstant.DEFAULT_USERNAME, 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}");
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ namespace AIParkingApplication
|
|||
|
||||
private void chkAutoLogin_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Util.UpsertAppSettings("AUTO_LOGIN", (sender as CheckBox).Checked.ToString().ToLower());
|
||||
Util.UpsertAppSettings(AppConstant.AUTO_LOGIN, (sender as CheckBox).Checked.ToString().ToLower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
|
@ -20,7 +21,8 @@ namespace AIParkingApplication
|
|||
this.maxSizePlate = maxSizePlate;
|
||||
this.scaleFactor = scaleFactor;
|
||||
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()
|
||||
|
@ -87,8 +89,8 @@ namespace AIParkingApplication
|
|||
|
||||
public static class PlateDetectorConstant
|
||||
{
|
||||
public const string SQUARE_PLATE_WEIGHT_FILENAME = "plate.xml";
|
||||
public const string LONG_PLATE_WEIGHT_FILENAME = "plateLong.xml";
|
||||
public const string SQUARE_PLATE_WEIGHT_FILENAME = @".\plate.xml";
|
||||
public const string LONG_PLATE_WEIGHT_FILENAME = @".\plateLong.xml";
|
||||
|
||||
public const double SCALE_FACTOR_DEFAULT_SQUARE_PLATE = 1.03;
|
||||
public static int MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE = 2;
|
||||
|
|
1
AIParkingApplication/Sidebar.Designer.cs
generated
1
AIParkingApplication/Sidebar.Designer.cs
generated
|
@ -36,6 +36,7 @@
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "Sidebar";
|
||||
this.Size = new System.Drawing.Size(192, 692);
|
||||
this.Load += new System.EventHandler(this.Sidebar_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,11 +8,20 @@ namespace AIParkingApplication
|
|||
public partial class Sidebar : UserControl
|
||||
{
|
||||
private Statistic statistic;
|
||||
private string logoImagePath;
|
||||
private ApiController apiController;
|
||||
|
||||
public Sidebar(ApiController apiController, string logoImagePath = AppConstant.DEFAULT_LOGO_IMAGE)
|
||||
{
|
||||
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;
|
||||
pictureBoxImageLogo = new PictureBox();
|
||||
|
|
Loading…
Reference in New Issue
Block a user