Now its responsive
This commit is contained in:
Generated
+18
-9
@@ -55,26 +55,30 @@
|
||||
// pbxRayons
|
||||
//
|
||||
this.pbxRayons.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbxRayons.Location = new System.Drawing.Point(12, 12);
|
||||
this.pbxRayons.Location = new System.Drawing.Point(0, 0);
|
||||
this.pbxRayons.Name = "pbxRayons";
|
||||
this.pbxRayons.Size = new System.Drawing.Size(1044, 357);
|
||||
this.pbxRayons.Size = new System.Drawing.Size(983, 300);
|
||||
this.pbxRayons.TabIndex = 0;
|
||||
this.pbxRayons.TabStop = false;
|
||||
this.pbxRayons.Click += new System.EventHandler(this.pbxRayons_Click);
|
||||
//
|
||||
// pbxCaisses
|
||||
//
|
||||
this.pbxCaisses.Location = new System.Drawing.Point(12, 575);
|
||||
this.pbxCaisses.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbxCaisses.Location = new System.Drawing.Point(0, 512);
|
||||
this.pbxCaisses.Name = "pbxCaisses";
|
||||
this.pbxCaisses.Size = new System.Drawing.Size(1044, 246);
|
||||
this.pbxCaisses.Size = new System.Drawing.Size(983, 200);
|
||||
this.pbxCaisses.TabIndex = 1;
|
||||
this.pbxCaisses.TabStop = false;
|
||||
this.pbxCaisses.Click += new System.EventHandler(this.pbxCaisses_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.btnAddTime);
|
||||
this.groupBox1.Controls.Add(this.btnAddClients);
|
||||
this.groupBox1.Controls.Add(this.btnStartStop);
|
||||
this.groupBox1.Location = new System.Drawing.Point(856, 12);
|
||||
this.groupBox1.Location = new System.Drawing.Point(1696, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(200, 125);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
@@ -111,13 +115,14 @@
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.lblTime);
|
||||
this.groupBox2.Controls.Add(this.lblAvgWaitingTime);
|
||||
this.groupBox2.Controls.Add(this.lblClients);
|
||||
this.groupBox2.Controls.Add(this.lblAvaiblePlaces);
|
||||
this.groupBox2.Controls.Add(this.lblClientsWithoutCheckout);
|
||||
this.groupBox2.Controls.Add(this.label1);
|
||||
this.groupBox2.Location = new System.Drawing.Point(856, 138);
|
||||
this.groupBox2.Location = new System.Drawing.Point(1696, 138);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(200, 120);
|
||||
this.groupBox2.TabIndex = 6;
|
||||
@@ -190,17 +195,19 @@
|
||||
//
|
||||
// pbxWaitRoom
|
||||
//
|
||||
this.pbxWaitRoom.Location = new System.Drawing.Point(12, 375);
|
||||
this.pbxWaitRoom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbxWaitRoom.Location = new System.Drawing.Point(0, 306);
|
||||
this.pbxWaitRoom.Name = "pbxWaitRoom";
|
||||
this.pbxWaitRoom.Size = new System.Drawing.Size(1044, 194);
|
||||
this.pbxWaitRoom.Size = new System.Drawing.Size(983, 200);
|
||||
this.pbxWaitRoom.TabIndex = 7;
|
||||
this.pbxWaitRoom.TabStop = false;
|
||||
this.pbxWaitRoom.Click += new System.EventHandler(this.pbxWaitRoom_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1062, 833);
|
||||
this.ClientSize = new System.Drawing.Size(1902, 1033);
|
||||
this.Controls.Add(this.pbxWaitRoom);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
@@ -208,6 +215,8 @@
|
||||
this.Controls.Add(this.pbxRayons);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.Resize += new System.EventHandler(this.Form1_Resize);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbxRayons)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbxCaisses)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
|
||||
+38
-4
@@ -17,7 +17,7 @@ namespace Caisses
|
||||
{
|
||||
InitializeComponent();
|
||||
DoubleBuffered = true;
|
||||
store = new GraphicalStore(10,12,pbxRayons.Size,pbxCaisses.Size,pbxWaitRoom.Size);
|
||||
store = new GraphicalStore(10,12,pbxCaisses.Size);
|
||||
}
|
||||
|
||||
private void btnStartStop_Click(object sender, EventArgs e)
|
||||
@@ -44,7 +44,7 @@ namespace Caisses
|
||||
|
||||
private void tmrDraw_Tick(object sender, EventArgs e)
|
||||
{
|
||||
List<Bitmap> result = store.Draw();
|
||||
List<Bitmap> result = store.Draw(pbxRayons.Size,pbxWaitRoom.Size,pbxCaisses.Size);
|
||||
if (pbxRayons.Image != null)
|
||||
{
|
||||
pbxRayons.Image.Dispose();
|
||||
@@ -58,8 +58,8 @@ namespace Caisses
|
||||
pbxWaitRoom.Image.Dispose();
|
||||
}
|
||||
pbxRayons.Image = result[0];
|
||||
pbxCaisses.Image = result[1];
|
||||
pbxWaitRoom.Image = result[2];
|
||||
pbxWaitRoom.Image = result[1];
|
||||
pbxCaisses.Image = result[2];
|
||||
|
||||
lblClients.Text = "Clients : " + store.Clients.Count();
|
||||
lblClientsWithoutCheckout.Text = "Clients without checkout : "+ store.WaitingClients.Count();
|
||||
@@ -67,5 +67,39 @@ namespace Caisses
|
||||
lblAvgWaitingTime.Text = "AverageWaitingTime = " + store.AverageWaitingTime;
|
||||
lblTime.Text = "Time of the day : "+store.TimeOfTheDayInHours + ":"+store.TimeOfTheDayInMinuts % 60;
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
ResizeCanvas();
|
||||
}
|
||||
|
||||
private void pbxWaitRoom_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pbxCaisses_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pbxRayons_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Form1_Resize(object sender, EventArgs e)
|
||||
{
|
||||
ResizeCanvas();
|
||||
}
|
||||
private void ResizeCanvas()
|
||||
{
|
||||
pbxRayons.Size = new Size(this.Width, Convert.ToInt32((this.Height / 10.0) * 5.0));
|
||||
pbxRayons.Location = new Point(0, 0);
|
||||
pbxWaitRoom.Size = new Size(this.Width, Convert.ToInt32((this.Height / 10.0) * 2.0));
|
||||
pbxWaitRoom.Location = new Point(0, pbxRayons.Height);
|
||||
pbxCaisses.Size = new Size(this.Width, Convert.ToInt32((this.Height / 10.0) * 3.0));
|
||||
pbxCaisses.Location = new Point(0, pbxWaitRoom.Location.Y + pbxWaitRoom.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,23 +19,18 @@ namespace Caisses
|
||||
public Color Color { get => _color; set => _color = value; }
|
||||
public Size Size { get => _size; set => _size = value; }
|
||||
public Rectangle Area { get => _area; set => _area = value; }
|
||||
public GraphicalCheckout(Point position,Rectangle area,int checkoutNumber)
|
||||
public GraphicalCheckout()
|
||||
{
|
||||
Random = new Random();
|
||||
Position = position;
|
||||
Color = Color.FromArgb(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255));
|
||||
Size = new Size(area.Width / checkoutNumber + 1,area.Height-area.Height/10);
|
||||
}
|
||||
public void Draw(Bitmap checkoutAreaImage)
|
||||
public void Draw(Bitmap checkoutAreaImage,int checkoutNumber, int checkoutId)
|
||||
{
|
||||
Size = new Size(checkoutAreaImage.Width / checkoutNumber + 1, checkoutAreaImage.Height - checkoutAreaImage.Height / 20);
|
||||
Position = new Point(checkoutId * Size.Width, 0);
|
||||
int radius = Math.Min(Size.Width, Size.Height / MAX_CAPACITY);
|
||||
Size clientSize = new Size(radius,radius);
|
||||
int xOffset = Size.Width / 2 - radius / 2;
|
||||
Graphics g = Graphics.FromImage(checkoutAreaImage);
|
||||
|
||||
|
||||
|
||||
|
||||
//g.DrawRectangle(new Pen(Color.FromArgb(Random.Next(0,255),Random.Next(0,255),Random.Next(0,255))),new Rectangle(Position,Size));
|
||||
g.DrawRectangle(new Pen(Color.Black),new Rectangle(Position,Size));
|
||||
if (Open)
|
||||
|
||||
+27
-27
@@ -15,9 +15,6 @@ namespace Caisses
|
||||
private List<GraphicalCheckout> _checkouts;
|
||||
private List<GraphicalClient> _clients;
|
||||
private int _timeOfTheDayInMinuts;
|
||||
private Bitmap _shelvesCorner;
|
||||
private Bitmap _checkoutCorner;
|
||||
private Bitmap _waitingCorner;
|
||||
private Random rnd;
|
||||
|
||||
/// Stats
|
||||
@@ -39,36 +36,30 @@ namespace Caisses
|
||||
public int TimeOfTheDayInMinuts { get => _timeOfTheDayInMinuts; set => _timeOfTheDayInMinuts = value; }
|
||||
public List<GraphicalClient> Clients { get => _clients; set => _clients = value; }
|
||||
internal List<GraphicalCheckout> Checkouts { get => _checkouts; set => _checkouts = value; }
|
||||
public Bitmap ShelvesCorner { get => _shelvesCorner; set => _shelvesCorner = value; }
|
||||
public Bitmap CheckoutCorner { get => _checkoutCorner; set => _checkoutCorner = value; }
|
||||
public Bitmap WaitingCorner { get => _waitingCorner; set => _waitingCorner = value; }
|
||||
|
||||
public int TimeOfTheDayInHours
|
||||
{
|
||||
get { return _timeOfTheDayInMinuts / 60; }
|
||||
}
|
||||
|
||||
public GraphicalStore(int startingHour, int checkoutNumber, Size shelvesCornerSize, Size checkoutCornerSize, Size waitingCornerSize)
|
||||
public GraphicalStore(int startingHour, int checkoutNumber, Size checkoutsRoom)
|
||||
{
|
||||
TimeOfTheDayInMinuts = startingHour * 60;
|
||||
Clients = new List<GraphicalClient>();
|
||||
Checkouts = new List<GraphicalCheckout>();
|
||||
CheckoutCorner = new Bitmap(checkoutCornerSize.Width, checkoutCornerSize.Height);
|
||||
ShelvesCorner = new Bitmap(shelvesCornerSize.Width, shelvesCornerSize.Height);
|
||||
WaitingCorner = new Bitmap(waitingCornerSize.Width, waitingCornerSize.Height);
|
||||
rnd = new Random();
|
||||
|
||||
FillStore(ATTENDANCE[TimeOfTheDayInHours]);
|
||||
populateCheckouts(checkoutNumber);
|
||||
populateCheckouts(checkoutsRoom,checkoutNumber);
|
||||
Tick();
|
||||
}
|
||||
public void populateCheckouts(int numberOfCheckouts)
|
||||
public void populateCheckouts(Size checkoutRoom,int checkoutNumber)
|
||||
{
|
||||
int checkoutWidth = CheckoutCorner.Width / numberOfCheckouts + 1;
|
||||
for (int i = 0; i < numberOfCheckouts; i++)
|
||||
int checkoutWidth = checkoutRoom.Width / checkoutNumber + 1;
|
||||
for (int i = 0; i < checkoutNumber; i++)
|
||||
{
|
||||
Point position = new Point(i * checkoutWidth + checkoutWidth / numberOfCheckouts, 0);
|
||||
Checkouts.Add(new GraphicalCheckout(position, new Rectangle(new Point(0, 0), new Size(CheckoutCorner.Width, CheckoutCorner.Height)), numberOfCheckouts));
|
||||
Point position = new Point(i * checkoutWidth + checkoutWidth / checkoutNumber, 0);
|
||||
Checkouts.Add(new GraphicalCheckout());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,26 +184,35 @@ namespace Caisses
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Bitmap> Draw()
|
||||
public List<Bitmap> Draw(Size shelvesRoom,Size waitRoom,Size checkoutsRoom)
|
||||
{
|
||||
ShelvesCorner = new Bitmap(ShelvesCorner.Width, ShelvesCorner.Height);
|
||||
CheckoutCorner = new Bitmap(CheckoutCorner.Width, CheckoutCorner.Height);
|
||||
WaitingCorner = new Bitmap(WaitingCorner.Width, WaitingCorner.Height);
|
||||
Bitmap shelvesImage = new Bitmap(shelvesRoom.Width,shelvesRoom.Height);
|
||||
Bitmap waitingRoomImage = new Bitmap(waitRoom.Width, waitRoom.Height);
|
||||
Bitmap checkoutsImage= new Bitmap(checkoutsRoom.Width,checkoutsRoom.Height);
|
||||
foreach (GraphicalClient client in Clients)
|
||||
{
|
||||
client.Draw(ShelvesCorner,WaitingCorner);
|
||||
client.Draw(shelvesImage, waitingRoomImage);
|
||||
}
|
||||
|
||||
foreach (GraphicalCheckout checkout in Checkouts)
|
||||
for (int i = 0; i < Checkouts.Count; i++)
|
||||
{
|
||||
checkout.Draw(CheckoutCorner);
|
||||
foreach (GraphicalClient client in checkout.Clients)
|
||||
Checkouts[i].Draw(checkoutsImage, Checkouts.Count,i);
|
||||
foreach (GraphicalClient client in Checkouts[i].Clients)
|
||||
{
|
||||
client.Draw(ShelvesCorner,WaitingCorner);
|
||||
client.Draw(shelvesImage, waitingRoomImage);
|
||||
}
|
||||
}
|
||||
|
||||
return new List<Bitmap> { ShelvesCorner, CheckoutCorner, WaitingCorner};
|
||||
/*
|
||||
foreach (GraphicalCheckout checkout in Checkouts)
|
||||
{
|
||||
checkout.Draw(checkoutsImage,Checkouts.Count, );
|
||||
foreach (GraphicalClient client in checkout.Clients)
|
||||
{
|
||||
client.Draw(shelvesImage,waitingRoomImage);
|
||||
}
|
||||
}
|
||||
*/
|
||||
return new List<Bitmap> { shelvesImage, waitingRoomImage, checkoutsImage};
|
||||
}
|
||||
public virtual void FillStore(int amountOfNewClients)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user