public void OnTheFloorReached() { if (TheFloorReached != null) { TheFloorReached.Invoke(this, EventArgs.Empty); } }
public bool OnTheFloorReached() { if (TheFloorReached != null) { return(TheFloorReached.Invoke()); } else { return(false); } }
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); } }