private void btnsuchen_Click(object sender, EventArgs e)
        {
            dtagridverbindungen.Rows.Clear();

            Stationssuche neuesuche   = new Stationssuche();
            string        vonStation  = comboboxvon.Text;
            string        nachStation = comboboxNach.Text;
            DateTime      zeitdatum   = datetimepickerDatum.Value;
            DateTime      uhrzeit     = datimZeit.Value;

            Connections verbindungenrückgabe = neuesuche.Stationverbindungssuche(vonStation, nachStation, zeitdatum, uhrzeit);

            try
            {
                List <Connection> verbindungrückgabliste = verbindungenrückgabe.ConnectionList;

                foreach (Connection einzelneverbindung in verbindungrückgabliste.Take(4))
                {
                    dtagridverbindungen.Rows.Add(einzelneverbindung.From.Station.Name, einzelneverbindung.To.Station.Name, Convert.ToDateTime(einzelneverbindung.From.Departure).ToString("MM-dd HH:mm"), Convert.ToDateTime(einzelneverbindung.To.Arrival).ToString("MM-dd HH:mm"), einzelneverbindung.To.Platform);
                }
                btnsend.Enabled = true;
            }
            catch
            {
                MessageBox.Show("Keine Verbindung gefunden");
                return;
            }
        }
示例#2
0
        void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            GeoCoordinate coord = watcher.Position.Location;

            if (coord.IsUnknown != true)
            {
                GeraetX = coord.Latitude;
                GeraetY = coord.Longitude;

                try
                {
                    Stationssuche  stationssuche       = new Stationssuche();
                    Stations       naechstebahnhofe    = stationssuche.Neachstestatonfinden(Convert.ToString(GeraetX), Convert.ToString(GeraetY));
                    List <Station> nachstebahnhofliste = naechstebahnhofe.StationList;

                    foreach (Station bahnhof in nachstebahnhofliste.Take(5))
                    {
                        dgvNaechsteStation.Rows.Add(bahnhof.Name, bahnhof.Distance);
                    }
                    this.Refresh();
                    watcher.Stop();
                }
                catch { MessageBox.Show("Keine Station gefunden!"); return; }
            }
            else
            {
                MessageBox.Show("Unbekannte Koordinaten!");
                System.Threading.Thread.Sleep(1000);
            }
        }
        public Stationssuche Abfahrtsplansuche(string eingabestationsname, Stationssuche neuesuche)
        {
            try
            {
                var stationsobjekte = transport.GetStations(query: eingabestationsname);

                List <Station> stationen = stationsobjekte.StationList;

                foreach (Station bahnhof in stationen)
                {
                    if (bahnhof.Name.Equals(eingabestationsname))
                    {
                        neuesuche.stationname = bahnhof.Name;
                        neuesuche.stationid   = bahnhof.Id;
                    }
                }

                StationBoardRoot stationsboard = transport.GetStationBoard(neuesuche.stationname, neuesuche.stationid);

                neuesuche.ausgehendeverbindungen = stationsboard;

                return(neuesuche);
            }
            catch { return(neuesuche); }
        }
        private void Vorschlage(object sender, EventArgs e)
        {
            try
            {
                comboboxvon.Items.Clear();

                Stationssuche neuesuche = new Stationssuche();

                List <Station> sucheresultat = neuesuche.Vorschlaege(comboboxvon.Text);
                try
                {
                    foreach (Station station in sucheresultat)
                    {
                        comboboxvon.Items.Add(station.Name);
                    }
                }
                catch { }
                comboboxvon.Focus();
                comboboxvon.SelectionStart = comboboxvon.Text.Length;
            }
            catch { return; }
        }
示例#5
0
        private void btnSucheStaton_Click(object sender, EventArgs e)
        {
            try{
                Stationssuche neuesuche = new Stationssuche();

                Setvonkodinaten(neuesuche.GetKordinaten(txtboxstation.Text));
                gmapKarte.DragButton  = MouseButtons.Left;
                gmapKarte.CanDragMap  = true;
                gmapKarte.MapProvider = GMapProviders.GoogleMap;
                gmapKarte.Position    = new PointLatLng(vonX, vonY);
                gmapKarte.MinZoom     = 5;
                gmapKarte.MaxZoom     = 25;
                gmapKarte.Zoom        = 10;
                gmapKarte.AutoScroll  = true;

                GMapOverlay markerOverlay = new GMapOverlay("makers");

                GMarkerGoogle marker = new GMarkerGoogle(new GMap.NET.PointLatLng(vonY, vonX), GMarkerGoogleType.green_pushpin);
                markerOverlay.Markers.Add(marker);
                gmapKarte.Overlays.Add(markerOverlay);
                gmapKarte.Refresh();
            }
            catch { MessageBox.Show("Keine Station gefunden!"); }
        }
        private void btnsuchen_Click(object sender, EventArgs e)
        {
            dtagridAbfahrtstagel.Rows.Clear();

            Stationssuche neuesuche     = new Stationssuche();
            Stationssuche sucheresultat = neuesuche.Abfahrtsplansuche(txtboxstation.Text, neuesuche);

            try
            {
                StationBoardRoot alleverbindungen = sucheresultat.getausgehendeverbindungen();

                List <StationBoard> verbindungsliste = alleverbindungen.Entries;

                foreach (StationBoard Ausgehendeverbindung in verbindungsliste)
                {
                    dtagridAbfahrtstagel.Rows.Add(Ausgehendeverbindung.To, Ausgehendeverbindung.Number, Ausgehendeverbindung.Name);
                }
            }
            catch
            {
                MessageBox.Show("Keine Resultate gefunden!");
                return;
            }
        }