106 lines
3.1 KiB
C#
106 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Caisses
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
GraphicalStore store;
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
DoubleBuffered = true;
|
|
store = new GraphicalStore(10,12,pbxCaisses.Size);
|
|
}
|
|
|
|
private void btnStartStop_Click(object sender, EventArgs e)
|
|
{
|
|
if (tmrRefresh.Enabled)
|
|
{
|
|
tmrRefresh.Stop();
|
|
tmrDraw.Stop();
|
|
btnStartStop.Text = "Start";
|
|
}
|
|
else
|
|
{
|
|
tmrRefresh.Start();
|
|
tmrDraw.Start();
|
|
btnStartStop.Text = "Stop";
|
|
}
|
|
|
|
}
|
|
|
|
private void tmrRefresh_Tick(object sender, EventArgs e)
|
|
{
|
|
store.Tick();
|
|
}
|
|
|
|
private void tmrDraw_Tick(object sender, EventArgs e)
|
|
{
|
|
List<Bitmap> result = store.Draw(pbxRayons.Size,pbxWaitRoom.Size,pbxCaisses.Size);
|
|
if (pbxRayons.Image != null)
|
|
{
|
|
pbxRayons.Image.Dispose();
|
|
}
|
|
if (pbxCaisses.Image != null)
|
|
{
|
|
pbxCaisses.Image.Dispose();
|
|
}
|
|
if (pbxWaitRoom.Image != null)
|
|
{
|
|
pbxWaitRoom.Image.Dispose();
|
|
}
|
|
pbxRayons.Image = result[0];
|
|
pbxWaitRoom.Image = result[1];
|
|
pbxCaisses.Image = result[2];
|
|
|
|
lblClients.Text = "Clients : " + store.Clients.Count();
|
|
lblClientsWithoutCheckout.Text = "Clients without checkout : "+ store.WaitingClients.Count();
|
|
lblAvaiblePlaces.Text = "Avaible places = " + store.TotalPlacesLeftCount;
|
|
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);
|
|
}
|
|
}
|
|
}
|