public ElevatorCar(string name, int currentFloor, Button button) { this.Name = name; this.CurrentFloor = currentFloor; this.button = button; this.Status = ElevatorCarStatus.Idle; }
public void ResetElevatorCar() { if (ElevatorDirection == ElevatorDirection.Upwards) { ServiceRequestListUpwards = null; } if (ElevatorDirection == ElevatorDirection.Downwards) { ServiceRequestListDownwards = null; } this.CurrentFloor = 0; this.Status = ElevatorCarStatus.Idle; this.ElevatorDirection = ElevatorDirection.None; Console.WriteLine($"All service request of Elevator : {this.Name} completed, status : {this.Status}!"); }
private void ProcessRequestCurrent() { //Checking at start to ensure scenarios when Elevator current level is equal to requestor current/destination floor if (CheckCurrentRequestCompletion(this.DestinationFloor)) { return; } while (this.CurrentFloor != this.DestinationFloor) { this.Status = ElevatorCarStatus.Busy; if (this.CurrentFloor - this.DestinationFloor > 0) { MoveDown(); } else { MoveUp(); } } //Checking at start to ensure scenarios when Elevator current level is equal to requestor current/destination floor CheckCurrentRequestCompletion(this.DestinationFloor); }
private void MovingState() { this.Status = ElevatorCarStatus.Busy; System.Threading.Thread.Sleep(1500); }