AIParkingApplicationForm - Add Func. UpdateMenuStripItemStatus
This commit is contained in:
parent
b46d79e101
commit
0cc0400b05
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
|
@ -124,28 +125,49 @@ namespace AIParkingApplication
|
|||
|
||||
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInIn();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneInOut();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutIn();
|
||||
}
|
||||
|
||||
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateMenuStripItemStatus(sender as ToolStripMenuItem);
|
||||
StopAllLanes();
|
||||
UpdateLaneOutOut();
|
||||
}
|
||||
|
||||
private void UpdateMenuStripItemStatus(ToolStripMenuItem selectedToolStripMenuItem)
|
||||
{
|
||||
if (selectedToolStripMenuItem != null)
|
||||
{
|
||||
((ToolStripMenuItem)selectedToolStripMenuItem.OwnerItem).DropDownItems
|
||||
.OfType<ToolStripMenuItem>().ToList()
|
||||
.ForEach(item =>
|
||||
{
|
||||
item.Checked = false;
|
||||
item.Enabled = true;
|
||||
});
|
||||
|
||||
selectedToolStripMenuItem.Checked = true;
|
||||
selectedToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void StopAllLanes()
|
||||
{
|
||||
laneIn12.DoorId = 10;
|
||||
|
|
Loading…
Reference in New Issue
Block a user