Beispiel #1
0
 public ViewModel()
 {
     Elevators.Add(new Elevator(0));
     Elevators.Add(new Elevator(1));
     Elevators.Add(new Elevator(2));
     Task.Factory.StartNew(Operator);
 }
Beispiel #2
0
 private void InitializeElevators(int numberOfElevators, int floors)
 {
     this.Output.OutputLine("*** Bringing Elevators Online ***");
     this.Elevators = new Dictionary <string, Elevator>();
     for (int i = 1; i < numberOfElevators + 1; i++)
     {
         var elevator = new Elevator(string.Format("Elevator {0}", i), this.Output, floors, i);
         Elevators.Add(elevator.Name, elevator);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Creates a new elevator.
        /// </summary>
        /// <param name="id">The ID of the elevator.</param>
        /// <returns>The newly created elevator.</returns>
        public Elevator CreateElevator(int id)
        {
            Elevator elevator = new Elevator(this)
            {
                ID = id
            };

            elevator.Queues = new Dictionary <Waypoint, List <Waypoint> >();
            Elevators.Add(elevator);
            _idToElevators[elevator.ID] = elevator;
            return(elevator);
        }
        public void BuildElevators(List<ElevatorData> elevators)
        {
            int min, max;
            foreach (ElevatorData data in elevators)
            {
                // Add elevator
                Elevators.Add(new Elevator(data.ID, data.Capacity, data.StartFloor));

                // Add distribution
                min = data.Period - data.Spread;
                max = data.Period + data.Spread;
                ElevatorsDistr.Add(data.ID, new UniformDistribution(min, max));
            }
        }
        private void AddElevatorHandle()
        {
            try
            {
                CheckCurrentElevator();

                Elevators.Add(new ElevatorData(CurrentElevator));
                CurrentElevator.ID++;
                OnPropertyChanged("CurrentElevator");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
            }
        }
Beispiel #6
0
 /// <summary>
 /// Adds an elevator
 /// </summary>
 /// <param name="speed">Speed of the elevator in m/s</param>
 /// <param name="delay">Delay between opening and closing the doors in seconds</param>
 public Elevator AddElevator(double speed, double delay)
 {
     Elevators.Add(new Elevator(this, speed, delay));
     return(Elevators[Elevators.Count - 1]);
 }