Compare commits
7 Commits
1418b1077e
...
59208674e0
Author | SHA1 | Date | |
---|---|---|---|
59208674e0 | |||
aa73bf8129 | |||
aa1aae8c6c | |||
1671d3b456 | |||
a3543084b7 | |||
89e766714a | |||
fd96643412 |
|
@ -127,6 +127,12 @@
|
|||
<Compile Include="AppConstant.cs" />
|
||||
<Compile Include="C3DeviceController.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="Enums.cs" />
|
||||
<Compile Include="ExtensitionMethods.cs" />
|
||||
|
@ -177,6 +183,9 @@
|
|||
<EmbeddedResource Include="AIParkingApplicationForm.resx">
|
||||
<DependentUpon>AIParkingApplicationForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ConfigurationForm.resx">
|
||||
<DependentUpon>ConfigurationForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LaneIn.resx">
|
||||
<DependentUpon>LaneIn.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -35,13 +35,15 @@
|
|||
this.toolStripMenuItemSwitchLaneInOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemSwitchLaneOutOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemSwitchLaneOutIn = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.setupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
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.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(1366, 24);
|
||||
|
@ -62,31 +64,38 @@
|
|||
// 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.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
||||
//
|
||||
// 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.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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -116,6 +125,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInOut;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutOut;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutIn;
|
||||
private System.Windows.Forms.ToolStripMenuItem setupToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,5 +304,11 @@ namespace AIParkingApplication
|
|||
appLogger.Log(LogLevel.Info, $"Đóng ứng dụng");
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void setupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var configurationForm = new ConfigurationForm(appLogger);
|
||||
configurationForm.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
<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>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
|
|
289
AIParkingApplication/ConfigurationForm.Designer.cs
generated
Normal file
289
AIParkingApplication/ConfigurationForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,289 @@
|
|||
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.txtDoorDeviceControlAccessIPStatus = 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();
|
||||
//
|
||||
// txtDoorDeviceControlAccessIPStatus
|
||||
//
|
||||
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:";
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// 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.txtDoorDeviceControlAccessIPStatus);
|
||||
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 txtDoorDeviceControlAccessIPStatus;
|
||||
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;
|
||||
}
|
||||
}
|
88
AIParkingApplication/ConfigurationForm.cs
Normal file
88
AIParkingApplication/ConfigurationForm.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
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)
|
||||
{
|
||||
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());
|
||||
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("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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
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>
|
|
@ -1,4 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
|
@ -161,6 +162,22 @@ namespace AIParkingApplication
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user