Compare commits
No commits in common. "daf755949a99321825103c82dfd94de2fa0ed827" and "74855b64675c5c0881438dc478925b2a077c8542" have entirely different histories.
daf755949a
...
74855b6467
|
@ -26,7 +26,7 @@ namespace AIParkingApplication
|
|||
this.apiController = apiController;
|
||||
this.configOnWeb = configOnWeb;
|
||||
|
||||
ReadAccessControlDeviceIPConfigurationFile();
|
||||
ReadAccessControlDeviceIPConfiguration();
|
||||
if (string.IsNullOrEmpty(doorAccessControlDeviceIP) || !Util.IsValidIPAddress(doorAccessControlDeviceIP))
|
||||
{
|
||||
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);
|
||||
|
@ -135,7 +135,6 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-IN");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInIn();
|
||||
|
@ -143,7 +142,6 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInOut();
|
||||
|
@ -151,7 +149,6 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "OUT-IN");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutIn();
|
||||
|
@ -159,7 +156,6 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "OUT-OUT");
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutOut();
|
||||
|
@ -200,51 +196,7 @@ namespace AIParkingApplication
|
|||
laneOut78?.Hide();
|
||||
}
|
||||
|
||||
private void InitLaneFirstTime()
|
||||
{
|
||||
try
|
||||
{
|
||||
string lanesConfig = ConfigurationManager.AppSettings["CURRENT_LANE_SETTING"];
|
||||
if (!string.IsNullOrEmpty(lanesConfig))
|
||||
{
|
||||
string[] lanes = lanesConfig.Split('-');
|
||||
if (lanes.Length == 2)
|
||||
{
|
||||
string lane0 = lanes[0].ToLower();
|
||||
string lane1 = lanes[1].ToLower();
|
||||
if (lane0 == "in" && lane1 == "in")
|
||||
{
|
||||
UpdateLaneInIn();
|
||||
}
|
||||
if (lane0 == "in" && lane1 == "out")
|
||||
{
|
||||
UpdateLaneInOut();
|
||||
}
|
||||
if (lane0 == "out" && lane1 == "in")
|
||||
{
|
||||
UpdateLaneOutIn();
|
||||
}
|
||||
if (lane0 == "out" && lane1 == "out")
|
||||
{
|
||||
UpdateLaneOutOut();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadAccessControlDeviceIPConfigurationFile()
|
||||
private void ReadAccessControlDeviceIPConfiguration()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -257,23 +209,14 @@ namespace AIParkingApplication
|
|||
}
|
||||
}
|
||||
|
||||
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void AIParkingApplicationForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
InitAllLanes();
|
||||
InitLaneFirstTime();
|
||||
}
|
||||
|
||||
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
DialogResult closeAppDialog = MessageBox.Show("Bạn chắc chắn thoát phần mềm quản lý bãi xe?", "Cảnh báo đóng ứng dụng: AIParking - Hệ thống quản lý bãi đỗ xe", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
|
||||
if (closeAppDialog == DialogResult.OK)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
<configuration>
|
||||
<appSettings>
|
||||
<add key="DOOR_ACCESS_DEVICE_CONTROL_IP" value="192.168.1.200" />
|
||||
<add key="DEFAULT_USERNAME" value="congvao1" />
|
||||
<add key="DEFAULT_PASSWORD" value="123456a@" />
|
||||
<add key="CURRENT_LANE_SETTING" value="OUT-OUT" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
|
|
5
AIParkingApplication/LoginForm.Designer.cs
generated
5
AIParkingApplication/LoginForm.Designer.cs
generated
|
@ -126,11 +126,9 @@
|
|||
// lblLoginStatus
|
||||
//
|
||||
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.ForeColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.lblLoginStatus.Location = new System.Drawing.Point(294, 117);
|
||||
this.lblLoginStatus.Name = "lblLoginStatus";
|
||||
this.lblLoginStatus.Size = new System.Drawing.Size(90, 18);
|
||||
this.lblLoginStatus.Size = new System.Drawing.Size(66, 13);
|
||||
this.lblLoginStatus.TabIndex = 4;
|
||||
this.lblLoginStatus.Text = "Login Status";
|
||||
//
|
||||
|
@ -156,7 +154,6 @@
|
|||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AIParking - Hệ thống quản lý bãi đỗ xe - Đăng nhập";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.LoginForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxImageLogo)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
@ -71,7 +69,7 @@ namespace AIParkingApplication
|
|||
var execeptioMessage = loginResult.Exception.Message;
|
||||
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("Tên tài khoản hoặc mật khẩu không đúng!", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -85,13 +83,13 @@ namespace AIParkingApplication
|
|||
|
||||
if (loginResult.IsLoginSuccess)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("DEFAULT_USERNAME", txtUsername.Text);
|
||||
Util.AddOrUpdateAppSettings("DEFAULT_PASSWORD", txtPassword.Text);
|
||||
new AIParkingApplicationForm(apiController, ipAddress, loginResult.LoginData).Show();
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
Login();
|
||||
|
@ -104,25 +102,5 @@ namespace AIParkingApplication
|
|||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadAppConfigurationFromFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
txtUsername.Text = ConfigurationManager.AppSettings["DEFAULT_USERNAME"];
|
||||
txtPassword.Text = ConfigurationManager.AppSettings["DEFAULT_PASSWORD"];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
||||
txtUsername.Text = string.Empty;
|
||||
txtPassword.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoginForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ReadAppConfigurationFromFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
@ -175,29 +174,6 @@ namespace AIParkingApplication
|
|||
hostName = hostParts[0];
|
||||
int.TryParse(hostParts[1], out port);
|
||||
}
|
||||
|
||||
public static void AddOrUpdateAppSettings(string key, string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
var settings = configFile.AppSettings.Settings;
|
||||
if (settings[key] == null)
|
||||
{
|
||||
settings.Add(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
settings[key].Value = value;
|
||||
}
|
||||
configFile.Save(ConfigurationSaveMode.Modified);
|
||||
ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
|
||||
}
|
||||
catch (ConfigurationErrorsException ex)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tAddOrUpdateAppSettings\t{ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PlateRequestEngineModel
|
||||
|
|
Loading…
Reference in New Issue
Block a user