Esempio n. 1
0
 public void OnTheFloorReached()
 {
     if (TheFloorReached != null)
     {
         TheFloorReached.Invoke(this, EventArgs.Empty);
     }
 }
Esempio n. 2
0
 public bool OnTheFloorReached()
 {
     if (TheFloorReached != null)
     {
         return(TheFloorReached.Invoke());
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Elevator elevator = new Elevator(ElevatorState.RESTING, 1);

            TheFloorReached += elevator.FloorReached;
            if (elevator.GotoFloor(3))
            {
                Thread.Sleep(2000);
                TheFloorReached.Invoke(null, EventArgs.Empty);
            }
            if (elevator.GotoFloor(3))
            {
                Thread.Sleep(2000);
                TheFloorReached.Invoke(null, EventArgs.Empty);
            }
            elevator.CloseDoor();
            if (elevator.GotoFloor(3))
            {
                Thread.Sleep(2000);
                TheFloorReached.Invoke(null, EventArgs.Empty);
            }
        }