Beispiel #1
0
 public void AddPint()
 {
     if (PintCount >= MaxPints)
     {
         throw new Exception("Dish full, no more pints for you!");
     }
     PintStarted?.Invoke(this, EventArgs.Empty);
     PintCount++;
     PintCompleted?.Invoke(this, new PintCompletedArgs());
 }
Beispiel #2
0
        public void AddPint()
        {
            if (pintCount >= (MaxPints - 1))
            {
                watch.Stop();
                DishCompleted?.Invoke(this, EventArgs.Empty, watch.ElapsedMilliseconds);
            }


            PintStarted?.Invoke(this, EventArgs.Empty);
            pintCount++;
            PintCompleted?.Invoke(this, new PintCompletedArgs());

            if (pintCount == (MaxPints / 2))
            {
                Dishhalfway?.Invoke(this, EventArgs.Empty);
            }
        }
Beispiel #3
0
        public void AddPint()
        {
            if (pintCount >= MaxPints)
            {
                throw new Exception("Dish full, order cancelled");
            }

            PintStarted?.Invoke(this, new PintStartedArgs());
            pintCount++;

            PintCompleted?.Invoke(this, new PintCompletedArgs());

            int halfWayPoint =
                MaxPints % 2 == 0 ? MaxPints / 2 : MaxPints / 2 + 1;

            if (PintCount == halfWayPoint)
            {
                DishHalfway?.Invoke(this, EventArgs.Empty);
            }
            if (PintCount >= MaxPints)
            {
                DishCompleted?.Invoke(this, new DishCompletedArgs(dishStarted));
            }
        }