Files
Std_Caisses/Caisses/Form1.cs
T

67 lines
1.9 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(20,12,pbxRayons.Size,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();
if (pbxRayons.Image != null)
{
pbxRayons.Image.Dispose();
}
if (pbxCaisses.Image != null)
{
pbxCaisses.Image.Dispose();
}
pbxRayons.Image = result[0];
pbxCaisses.Image = result[1];
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;
}
}
}