Ejemplo n.º 1
0
 public ElevatorCar(string name, int currentFloor, Button button)
 {
     this.Name         = name;
     this.CurrentFloor = currentFloor;
     this.button       = button;
     this.Status       = ElevatorCarStatus.Idle;
 }
Ejemplo n.º 2
0
        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}!");
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 private void MovingState()
 {
     this.Status = ElevatorCarStatus.Busy;
     System.Threading.Thread.Sleep(1500);
 }