Exemple #1
0
 void fillTimer_Tick(object sender, System.EventArgs e)
 {
     litersCounter++;
     if (litersCounter > currenOperation.Litres)
     {
         fillTimer.Stop();
         StatisiticProcessor.Instance.AddOperation(currenOperation);
         currenOperation = null;
         car.GoHome();
         LayoutRoot.Visibility = System.Windows.Visibility.Collapsed;
     }
     else
     {
         labelCounter.Text = litersCounter.ToString("0000");
     }
 }
Exemple #2
0
        /// <summary>
        /// Fills the fuel tank.
        /// </summary>
        /// <param name="car">The car.</param>
        public void FillFuelTank(Car car)
        {
            litersCounter = 0;
            this.car      = car;

            currenOperation            = new FuelingOperation();
            currenOperation.Litres     = (short)Randomizer.GetIntegerBetween(20, 50);
            currenOperation.PumpNumber = Number;
            currenOperation.FuelType   = (FuelType)Randomizer.GetIntegerBetween(0, 3);

            var brush = (Brush)Resources["brush" + currenOperation.FuelType];

            labelBackground.Fill = brush;
            hobot.Fill           = brush;

            labelFuelType.Text    = currenOperation.FuelType.ToString();
            labelCounter.Text     = litersCounter.ToString("0000");
            LayoutRoot.Visibility = System.Windows.Visibility.Visible;


            fillTimer.Start();
        }
Exemple #3
0
 /// <summary>
 /// Adds the operation.
 /// </summary>
 /// <param name="operation">The operation.</param>
 public void AddOperation(FuelingOperation operation)
 {
     operation.Hours   = VirtualClock.Instance.ClockData.Hours;
     operation.Minutes = VirtualClock.Instance.ClockData.Minutes;
     data.Add(operation);
 }