Beispiel #1
0
        //--------------------------------------------------
        // Station Timetable presentation
        //--------------------------------------------------

        private void fillStationDetails(String stationName)
        {
            if (stationName == "")
            {
                return;
            }

            TrainStation station = TrainStationCache.getInstance().getCacheContentOnName(stationName);

            textBoxStationID.Text           = station.Id.ToString();
            textBoxStationName.Text         = station.Name;
            textBoxStationCategory.Text     = station.TownCategory.ToString();
            textBoxStationInhabitation.Text = station.Inhabitation.ToString();
        }
Beispiel #2
0
        private void prepareListViewStationTimetable(Timetable timetable, String stationName)
        {
            listViewStationTimetable.BeginUpdate();
            listViewStationTimetable.Items.Clear();

            // determine trainStation
            TrainStation station = TrainStationCache.getInstance().getCacheContentOnName(stationName);
            // find all lines passing this station
            List <TrainLineVariable> lines = findTrainLinesVariable(station.getTrainLines(), timetable);

            foreach (TrainLineVariable line in lines)
            {
                TrainStop stop = line.Line.getTrainStopOnStation(station.Name);

                Time arrival   = stop.TimeArrival;
                Time departure = stop.TimeDeparture;

                int m = (END_TIME_OF_ST - START_TIME_OF_ST).ToMinutes();
                // loop until we are still in interval -> max M
                for (int i = 0; i *(int)line.Period < m; i++)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = line.LineNumber.ToString();
                    lvi.Tag  = line.LineNumber.ToString();

                    // if areival is not equal 00:00
                    if (!arrival.Equals(Time.MinValue))
                    {
                        // start time of timetable + arrival on station + period time solutionFactor
                        lvi.SubItems.Add((START_TIME_OF_ST + arrival + line.StartTime + Time.ToTime(i * (int)line.Period)).ToString());
                    }
                    // otherwise
                    else
                    {
                        // if stop is the first, there no arrival exists
                        if (stop.OrderInTrainLine.Equals(0))
                        {
                            lvi.SubItems.Add("");
                        }
                        // otherwise (time is 00:00 but the stop is not first) use departure
                        else
                        {
                            lvi.SubItems.Add((START_TIME_OF_ST + departure + line.StartTime + Time.ToTime(i * (int)line.Period)).ToString());
                        }
                    }

                    // if departure is not equal 00:00
                    if (!departure.Equals(Time.MinValue))
                    {
                        lvi.SubItems.Add((START_TIME_OF_ST + departure + line.StartTime + Time.ToTime(i * (int)line.Period)).ToString());
                    }
                    // otherwise
                    else
                    {
                        // if stop is a first one, there it is a legal time, use it
                        if (stop.OrderInTrainLine.Equals(0))
                        {
                            lvi.SubItems.Add((START_TIME_OF_ST + Time.MinValue + line.StartTime + Time.ToTime(i * (int)line.Period)).ToString());
                        }
                        // otherwise (time is 00:00 but the stop is not first)
                        else
                        {
                            // it has to be last stop, which has no departure (not continue)
                            lvi.SubItems.Add("");
                        }
                    }

                    listViewStationTimetable.Items.Add(lvi);
                }
            }



            listViewStationTimetable.EndUpdate();
        }
 /// <summary>
 /// Sets the default values.
 /// </summary>
 private void setDefaultValues()
 {
     this.timetables    = new List <Timetable>();
     this.TrainLines    = TrainLineCache.getInstance().getCacheContent();
     this.TrainStations = TrainStationCache.getInstance().getCacheContent();
 }