Add Sidebar. Fix Statistic UI.

This commit is contained in:
DucDangAnh 2020-07-06 10:30:59 +07:00
parent 98538a3fba
commit 3af336a184
6 changed files with 227 additions and 15 deletions

View File

@ -121,6 +121,12 @@
<Compile Include="PlateProcessor.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sidebar.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Sidebar.Designer.cs">
<DependentUpon>Sidebar.cs</DependentUpon>
</Compile>
<Compile Include="Statistic.cs">
<SubType>UserControl</SubType>
</Compile>
@ -153,6 +159,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Sidebar.resx">
<DependentUpon>Sidebar.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Statistic.resx">
<DependentUpon>Statistic.cs</DependentUpon>
</EmbeddedResource>

View File

@ -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();
}

45
AIParkingApplication/Sidebar.Designer.cs generated Normal file
View File

@ -0,0 +1,45 @@
namespace AIParkingApplication
{
partial class Sidebar
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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
}
}

View File

@ -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);
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -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();