Example #1
0
        /// <summary>
        /// Aktualizowanie statystyk
        /// </summary>
        /// <param name="lane"></param>
        public void Update(Lane lane)
        {
            for (int i = 1; i < 9; i++)
            {
                string amount          = VehicleCount(lane, (VehicleType)i, VehicleStorage.GetLane(lane));
                string amountFromStart = VehicleCount(lane, (VehicleType)i, VehicleStorage.GetLaneFromStart(lane));

                if (lane == Lane.Lane1)
                {
                    CountLane1[i - 1] = amount + " (" + amountFromStart + ")";
                }

                if (lane == Lane.Lane2)
                {
                    CountLane2[i - 1] = amount + " (" + amountFromStart + ")";
                }

                if (lane == Lane.Lane3)
                {
                    CountLane3[i - 1] = amount + " (" + amountFromStart + ")";
                }

                if (lane == Lane.Lane4)
                {
                    CountLane4[i - 1] = amount + " (" + amountFromStart + ")";
                }
            }

            OnPropertyChanged(nameof(DirectionLane1));
            OnPropertyChanged(nameof(DirectionLane2));
            OnPropertyChanged(nameof(DirectionLane3));
            OnPropertyChanged(nameof(DirectionLane4));
        }
Example #2
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="lane">pas na ktorym jest pojazd</param>
        /// <param name="vehicleType">typ pojazdu</param>
        /// <param name="vehicleColor">kolor pojazdu</param>
        public VehicleViewModel(Lane lane, VehicleType vehicleType, string vehicleColor)
        {
            VehicleStorage.AddVehicle(this, lane);

            Lane          = lane;
            Type          = vehicleType;
            Color         = vehicleColor;
            ArrivalTime   = DateTime.Now;
            Enabled       = VehicleStorage.GetLane(lane).Count - 1 > 0 ? false : true;
            QueuePosition = VehicleStorage.GetLane(lane).Count;
        }