Beispiel #1
0
        /// <summary>
        /// Sets buses line list
        /// </summary>
        /// <param name="stationsList"></param>
        /// <returns>Collction of buses line</returns>
        private static BusesLineCollection setBusLinecollection(List <LineStation> stationsList)
        {
            BusesLineCollection busCollection = new BusesLineCollection();
            double             _busLine       = 1;
            AreaNum            _area          = 0;
            Random             randomArea     = new Random(0);
            List <LineStation> rode           = new List <LineStation>();

            for (int i = 0; i < 10; i++)
            {
                _area = (AreaNum)randomArea.Next(0, 3);
                BusesLine bus = new BusesLine(_busLine + i, stationsList[i], _area);
                busCollection.addLine(bus);
            }
            int j = 9;

            for (int i = 0; i < 10; i++)
            {
                busCollection[j--].addStation(stationsList[i]);
            }
            Random randomLine = new Random(0);

            foreach (LineStation station in stationsList)
            {
                int lineIndex = randomLine.Next(0, 9);
                busCollection[lineIndex].addStation(station);
            }
            return(busCollection);
        }
Beispiel #2
0
 public MainWindow()
 { // Contructor
     InitializeComponent();
     busLines = setBusLinecollection(setStationsList());
     cbBusLines.ItemsSource       = busLines;
     cbBusLines.DisplayMemberPath = " BusLine";
     cbBusLines.SelectedIndex     = 0;
 }