예제 #1
0
        private void btnDeparture_Click(object sender, EventArgs e)
        {
            ITransport    transport     = new Transport();
            StationFinder stationFinder = new StationFinder();

            if (!stationFinder.IsStationAvailable(cmbStartStation.Text))
            {
                MessageBox.Show("Station: \"" + cmbStartStation.Text + "\" nicht gefunden.");
                return;
            }

            Station  station  = stationFinder.FindStation(cmbStartStation.Text);
            string   id       = station.Id;
            DateTime dateTime = dateTimePicker1.Value.Date;

            dateTime += dateTimePicker2.Value.TimeOfDay;

            lsbResult1.Items.Clear();
            lsbResult1.Items.Add("Abfahrten ab: " + transport.GetStationBoard(cmbStartStation.Text, id, dateTime).Station.Name + "\n");

            foreach (StationBoard elem in transport.GetStationBoard(cmbStartStation.Text, id, dateTime).Entries)
            {
                string paddedTo   = elem.To.PadRight(25);
                string paddedInfo = elem.Category.ToString() + elem.Number.ToString();
                paddedInfo = paddedInfo.PadRight(20);
                lsbResult1.Items.Add(paddedTo + paddedInfo + elem.Stop.Departure + "\n");
            }
        }
예제 #2
0
        private void btnEndMap_Click(object sender, EventArgs e)
        {
            StationFinder stationFinder = new StationFinder();

            if (!stationFinder.IsStationAvailable(cmbEndStation.Text))
            {
                MessageBox.Show("Station: \"" + cmbEndStation.Text + "\" nicht gefunden.");
                return;
            }

            Station station = stationFinder.FindStation(cmbEndStation.Text);

            System.Diagnostics.Process.Start("http://www.google.com/maps/place/" + station.Coordinate.XCoordinate.ToString().Replace(",", ".") + "," + station.Coordinate.YCoordinate.ToString().Replace(",", "."));
        }