diff --git a/AIParkingApplication/AIParkingApplication.csproj b/AIParkingApplication/AIParkingApplication.csproj index b93cdfb..7232554 100644 --- a/AIParkingApplication/AIParkingApplication.csproj +++ b/AIParkingApplication/AIParkingApplication.csproj @@ -121,6 +121,12 @@ + + UserControl + + + Sidebar.cs + UserControl @@ -153,6 +159,9 @@ Resources.resx True + + Sidebar.cs + Statistic.cs diff --git a/AIParkingApplication/AIParkingApplicationForm.cs b/AIParkingApplication/AIParkingApplicationForm.cs index a960e88..b6a650e 100644 --- a/AIParkingApplication/AIParkingApplicationForm.cs +++ b/AIParkingApplication/AIParkingApplicationForm.cs @@ -11,30 +11,32 @@ namespace AIParkingApplication private LaneIn laneIn; private LaneOut laneOut; private StatusBar statusBar; - private Statistic statistic; + private Sidebar sidebar; public AIParkingApplicationForm() { InitializeComponent(); string serverBaseAddress = "http://localhost:80/"; apiController = new ApiController(serverBaseAddress); + + sidebar = new Sidebar(apiController); + sidebar.Location = new System.Drawing.Point(0, 0); + Controls.Add(sidebar); + c3Device = new C3DeviceController("192.168.1.200"); laneIn = new LaneIn(1, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true); + laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, 0); Controls.Add(laneIn); laneOut = new LaneOut(2, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true); - laneOut.Location = new System.Drawing.Point(450, 0); + laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, 0); Controls.Add(laneOut); statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1)); - statusBar.Location = new System.Drawing.Point(0, 692); + statusBar.Location = new System.Drawing.Point(0, 700); statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; Controls.Add(statusBar); - statistic = new Statistic(apiController, TimeSpan.FromMinutes(10)); - statistic.Location = new System.Drawing.Point(laneIn.Width + laneOut.Width + 10, 0); - statistic.Anchor = AnchorStyles.Top | AnchorStyles.Left; - Controls.Add(statistic); StartLanes(); } diff --git a/AIParkingApplication/Sidebar.Designer.cs b/AIParkingApplication/Sidebar.Designer.cs new file mode 100644 index 0000000..1603dcd --- /dev/null +++ b/AIParkingApplication/Sidebar.Designer.cs @@ -0,0 +1,45 @@ +namespace AIParkingApplication +{ + partial class Sidebar + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // Sidebar + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "Sidebar"; + this.Size = new System.Drawing.Size(192, 692); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/AIParkingApplication/Sidebar.cs b/AIParkingApplication/Sidebar.cs new file mode 100644 index 0000000..88c4b5c --- /dev/null +++ b/AIParkingApplication/Sidebar.cs @@ -0,0 +1,33 @@ +using System; +using System.Drawing; +using System.IO; +using System.Windows.Forms; + +namespace AIParkingApplication +{ + public partial class Sidebar : UserControl + { + private Statistic statistic; + + public Sidebar(ApiController apiController, string logoImagePath = @"C:\Users\B.I\Desktop\photo_2020-06-25_21-22-56.jpg") + { + InitializeComponent(); + if (File.Exists(logoImagePath)) + { + PictureBox pictureBoxImageLogo; + pictureBoxImageLogo = new PictureBox(); + pictureBoxImageLogo.Location = new Point(1, 1); + pictureBoxImageLogo.BorderStyle = BorderStyle.FixedSingle; + pictureBoxImageLogo.Size = new Size(185, 185); + pictureBoxImageLogo.SizeMode = PictureBoxSizeMode.StretchImage; + pictureBoxImageLogo.Image = new Bitmap(logoImagePath); + Controls.Add(pictureBoxImageLogo); + } + + statistic = new Statistic(apiController, TimeSpan.FromMinutes(10)); + statistic.Location = new Point(0, 400); + statistic.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + Controls.Add(statistic); + } + } +} diff --git a/AIParkingApplication/Sidebar.resx b/AIParkingApplication/Sidebar.resx new file mode 100644 index 0000000..61bc649 --- /dev/null +++ b/AIParkingApplication/Sidebar.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file diff --git a/AIParkingApplication/Statistic.Designer.cs b/AIParkingApplication/Statistic.Designer.cs index 5ebd733..65d3e25 100644 --- a/AIParkingApplication/Statistic.Designer.cs +++ b/AIParkingApplication/Statistic.Designer.cs @@ -62,7 +62,7 @@ this.grbVehicleStatistics.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.grbVehicleStatistics.Location = new System.Drawing.Point(1, 1); this.grbVehicleStatistics.Name = "grbVehicleStatistics"; - this.grbVehicleStatistics.Size = new System.Drawing.Size(191, 178); + this.grbVehicleStatistics.Size = new System.Drawing.Size(189, 178); this.grbVehicleStatistics.TabIndex = 0; this.grbVehicleStatistics.TabStop = false; this.grbVehicleStatistics.Text = "Thống kê xe"; @@ -129,7 +129,7 @@ this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tlpStatisticTable.Size = new System.Drawing.Size(180, 100); + this.tlpStatisticTable.Size = new System.Drawing.Size(178, 100); this.tlpStatisticTable.TabIndex = 0; // // lblLoaiXe @@ -146,7 +146,7 @@ // this.lblSoLuong.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblSoLuong.AutoSize = true; - this.lblSoLuong.Location = new System.Drawing.Point(101, 8); + this.lblSoLuong.Location = new System.Drawing.Point(99, 8); this.lblSoLuong.Name = "lblSoLuong"; this.lblSoLuong.Size = new System.Drawing.Size(67, 18); this.lblSoLuong.TabIndex = 0; @@ -156,7 +156,7 @@ // this.lblXeMay.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblXeMay.AutoSize = true; - this.lblXeMay.Location = new System.Drawing.Point(16, 41); + this.lblXeMay.Location = new System.Drawing.Point(15, 41); this.lblXeMay.Name = "lblXeMay"; this.lblXeMay.Size = new System.Drawing.Size(58, 18); this.lblXeMay.TabIndex = 0; @@ -166,7 +166,7 @@ // this.lblSoLuongXeMay.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblSoLuongXeMay.AutoSize = true; - this.lblSoLuongXeMay.Location = new System.Drawing.Point(126, 41); + this.lblSoLuongXeMay.Location = new System.Drawing.Point(125, 41); this.lblSoLuongXeMay.Name = "lblSoLuongXeMay"; this.lblSoLuongXeMay.Size = new System.Drawing.Size(16, 18); this.lblSoLuongXeMay.TabIndex = 0; @@ -186,7 +186,7 @@ // this.lblSoLuongOto.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblSoLuongOto.AutoSize = true; - this.lblSoLuongOto.Location = new System.Drawing.Point(126, 74); + this.lblSoLuongOto.Location = new System.Drawing.Point(125, 74); this.lblSoLuongOto.Name = "lblSoLuongOto"; this.lblSoLuongOto.Size = new System.Drawing.Size(16, 18); this.lblSoLuongOto.TabIndex = 0; @@ -203,7 +203,7 @@ this.grbLoginInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.grbLoginInfo.Location = new System.Drawing.Point(1, 198); this.grbLoginInfo.Name = "grbLoginInfo"; - this.grbLoginInfo.Size = new System.Drawing.Size(191, 93); + this.grbLoginInfo.Size = new System.Drawing.Size(190, 93); this.grbLoginInfo.TabIndex = 1; this.grbLoginInfo.TabStop = false; this.grbLoginInfo.Text = "Thông tin tài khoản"; @@ -255,7 +255,7 @@ this.Controls.Add(this.grbLoginInfo); this.Controls.Add(this.grbVehicleStatistics); this.Name = "Statistic"; - this.Size = new System.Drawing.Size(193, 292); + this.Size = new System.Drawing.Size(192, 292); this.grbVehicleStatistics.ResumeLayout(false); this.tlpStatisticTable.ResumeLayout(false); this.tlpStatisticTable.PerformLayout();