AIParkingApplicationForm - Add menustrip for laneswitch.

This commit is contained in:
DucDangAnh 2020-07-08 13:54:01 +07:00
parent 5b3d0f95c8
commit 7f61711e61
3 changed files with 100 additions and 10 deletions

View File

@ -29,23 +29,89 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AIParkingApplicationForm));
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.toolStripMenuItemSwitchLane = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSwitchLaneInIn = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSwitchLaneInOut = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSwitchLaneOutOut = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSwitchLaneOutIn = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemSwitchLane});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1366, 24);
this.menuStrip.TabIndex = 0;
this.menuStrip.Text = "menuStrip1";
//
// toolStripMenuItemSwitchLane
//
this.toolStripMenuItemSwitchLane.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemSwitchLaneInIn,
this.toolStripMenuItemSwitchLaneInOut,
this.toolStripMenuItemSwitchLaneOutOut,
this.toolStripMenuItemSwitchLaneOutIn});
this.toolStripMenuItemSwitchLane.Name = "toolStripMenuItemSwitchLane";
this.toolStripMenuItemSwitchLane.Size = new System.Drawing.Size(59, 20);
this.toolStripMenuItemSwitchLane.Text = "Đảo làn";
//
// toolStripMenuItemSwitchLaneInIn
//
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
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(180, 22);
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
//
// toolStripMenuItemSwitchLaneOutOut
//
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
//
// toolStripMenuItemSwitchLaneOutIn
//
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
//
// AIParkingApplicationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1366, 737);
this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip;
this.MinimumSize = new System.Drawing.Size(1382, 776);
this.Name = "AIParkingApplicationForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AIParking - Phần mềm quản lý bãi đỗ xe";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AIParkingApplicationForm_FormClosing);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLane;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInIn;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInOut;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutOut;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutIn;
}
}

View File

@ -13,6 +13,7 @@ namespace AIParkingApplication
private StatusBar statusBar;
private Sidebar sidebar;
private Config configOnWeb;
private EngineApiController engineApiController;
public AIParkingApplicationForm(ApiController apiController, Config configOnWeb)
{
@ -25,7 +26,6 @@ namespace AIParkingApplication
Controls.Add(sidebar);
c3Device = new C3DeviceController("192.168.1.200");
EngineApiController engineApiController = null;
try
{
@ -38,12 +38,12 @@ namespace AIParkingApplication
}
laneIn = new LaneIn(1, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneIn.BorderStyle = BorderStyle.FixedSingle;
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, 0);
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
Controls.Add(laneIn);
laneOut = new LaneOut(2, this.configOnWeb.CameraData3.StreamUrl, this.configOnWeb.CameraData4.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneOut.BorderStyle = BorderStyle.FixedSingle;
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, 0);
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, menuStrip.Height);
Controls.Add(laneOut);
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
@ -54,17 +54,38 @@ namespace AIParkingApplication
StartLanes();
}
~AIParkingApplicationForm()
{
laneIn.Stop();
laneOut.Stop();
Application.Exit();
}
private void StartLanes()
{
laneIn.Start();
laneOut.Start();
}
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
{
laneIn.Stop();
laneOut.Stop();
laneIn.Hide();
laneOut.Hide();
LaneIn laneIn1, laneIn2;
laneIn1 = new LaneIn(1, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneIn1.BorderStyle = BorderStyle.FixedSingle;
laneIn1.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
Controls.Add(laneIn1);
laneIn2 = new LaneIn(2, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneIn2.BorderStyle = BorderStyle.FixedSingle;
laneIn2.Location = new System.Drawing.Point(laneIn1.Location.X + laneIn1.Width + 20, menuStrip.Height);
Controls.Add(laneIn2);
laneIn1.Start();
laneIn2.Start();
this.MinimumSize = new System.Drawing.Size(500, 768);
this.Width = 500;
}
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>