コード例 #1
0
 public void Update(TrainStation station)
 {
     lblCurrentSt.Text  = station.Name;
     lblRailwayTrk.Text = station.ArrivalTrack;
     lblArrival.Text    = station.ArrivalTime.ToString();
     lblDeparture.Text  = station.DepartureTime.ToString();
 }
コード例 #2
0
        public TrainJourney()
        {
            stations.Add(new TrainStation("Delft", "1", new DateTime(2020, 05, 06, 07, 09, 00), new DateTime(2020, 05, 06, 07, 09, 00)));
            stations.Add(new TrainStation("Den Haag HS", "6", new DateTime(2020, 05, 06, 07, 16, 00), new DateTime(2020, 05, 06, 07, 18, 00)));
            stations.Add(new TrainStation("Den Haag Laan v NOI", "6", new DateTime(2020, 05, 06, 07, 21, 00), new DateTime(2020, 05, 06, 07, 21, 00)));
            stations.Add(new TrainStation("Leiden Centraal", "5b", new DateTime(2020, 05, 06, 07, 30, 00), new DateTime(2020, 05, 06, 07, 31, 00)));
            stations.Add(new TrainStation("Schiphol Airport", "1-2", new DateTime(2020, 05, 06, 07, 46, 00), new DateTime(2020, 05, 06, 07, 46, 00)));

            currentStationNo = 0;
            direction        = true;
            currentStation   = stations[currentStationNo];
        }
コード例 #3
0
        public void NextStation()
        {
            currentStation = stations[currentStationNo];

            if (currentStationNo == stations.Count - 1)
            {
                direction = false;
            }
            else if (currentStationNo == 0)
            {
                direction = true;
            }

            if (direction)
            {
                currentStationNo++;
            }
            else
            {
                currentStationNo--;
            }

            NotifyObservers();
        }