AIParkingApplicationForm - hardcoded to const CURRENT_LANE_SETTING_KEY. Util - Add extensition method: DisableSelected
This commit is contained in:
parent
0375eac88d
commit
740858693e
|
@ -8,6 +8,8 @@ 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;
|
||||
|
@ -92,6 +94,8 @@ namespace AIParkingApplication
|
|||
laneOut34.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||
laneOut34.Show();
|
||||
laneOut34.Start();
|
||||
|
||||
toolStripMenuItemSwitchLaneInOut.DisableSelected();
|
||||
}
|
||||
|
||||
private void UpdateLaneInIn()
|
||||
|
@ -105,6 +109,8 @@ namespace AIParkingApplication
|
|||
laneIn56.Location = new Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
|
||||
laneIn56.Show();
|
||||
laneIn56.Start();
|
||||
|
||||
toolStripMenuItemSwitchLaneInIn.DisableSelected();
|
||||
}
|
||||
|
||||
private void UpdateLaneOutIn()
|
||||
|
@ -118,6 +124,8 @@ namespace AIParkingApplication
|
|||
laneIn56.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||
laneIn56.Show();
|
||||
laneIn56.Start();
|
||||
|
||||
toolStripMenuItemSwitchLaneOutIn.DisableSelected();
|
||||
}
|
||||
|
||||
private void UpdateLaneOutOut()
|
||||
|
@ -131,11 +139,13 @@ namespace AIParkingApplication
|
|||
laneOut34.Location = new Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
|
||||
laneOut34.Show();
|
||||
laneOut34.Start();
|
||||
|
||||
toolStripMenuItemSwitchLaneOutOut.DisableSelected();
|
||||
}
|
||||
|
||||
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);
|
||||
StopAllLanes();
|
||||
UpdateLaneInIn();
|
||||
|
@ -143,7 +153,7 @@ namespace AIParkingApplication
|
|||
|
||||
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);
|
||||
StopAllLanes();
|
||||
UpdateLaneInOut();
|
||||
|
@ -151,7 +161,7 @@ namespace AIParkingApplication
|
|||
|
||||
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);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutIn();
|
||||
|
@ -159,7 +169,7 @@ namespace AIParkingApplication
|
|||
|
||||
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);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutOut();
|
||||
|
@ -204,7 +214,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
try
|
||||
{
|
||||
string lanesConfig = ConfigurationManager.AppSettings["CURRENT_LANE_SETTING"];
|
||||
string lanesConfig = ConfigurationManager.AppSettings[CURRENT_LANE_SETTING_KEY];
|
||||
if (!string.IsNullOrEmpty(lanesConfig))
|
||||
{
|
||||
string[] lanes = lanesConfig.Split('-');
|
||||
|
@ -215,14 +225,17 @@ namespace AIParkingApplication
|
|||
if (lane0 == "in" && lane1 == "in")
|
||||
{
|
||||
UpdateLaneInIn();
|
||||
|
||||
}
|
||||
if (lane0 == "in" && lane1 == "out")
|
||||
{
|
||||
UpdateLaneInOut();
|
||||
|
||||
}
|
||||
if (lane0 == "out" && lane1 == "in")
|
||||
{
|
||||
UpdateLaneOutIn();
|
||||
|
||||
}
|
||||
if (lane0 == "out" && lane1 == "out")
|
||||
{
|
||||
|
@ -231,14 +244,14 @@ namespace AIParkingApplication
|
|||
}
|
||||
else
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("CURRENT_LANE_SETTING", "IN-OUT");
|
||||
Util.AddOrUpdateAppSettings(CURRENT_LANE_SETTING_KEY, "IN-OUT");
|
||||
UpdateLaneInOut();
|
||||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadLaneSettingFromConfigurationFile\t{ex.Message}");
|
||||
}
|
||||
|
|
|
@ -198,6 +198,12 @@ namespace AIParkingApplication
|
|||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tAddOrUpdateAppSettings\t{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisableSelected(this ToolStripMenuItem toolStripMenuItem)
|
||||
{
|
||||
toolStripMenuItem.Checked = true;
|
||||
toolStripMenuItem.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlateRequestEngineModel
|
||||
|
|
Loading…
Reference in New Issue
Block a user