private void AddItemsToDropdown(ComboBox comboBox)
 {
     comboBox.DroppedDown = true;
     foreach (SwissTransport.Station station in transport.GetStations(comboBox.Text).StationList)
     {
         if (station.Name != null)
         {
             comboBox.Items.Add(station.Name);
         }
     }
 }
 private void cboDepartureStation_TextUpdate(object sender, EventArgs e)
 {
     cboDepartureStation.Items.Clear();
     cboDepartureStation.SelectionStart  = cboDepartureStation.Text.Length;
     cboDepartureStation.SelectionLength = 0;
     cboDepartureStation.DroppedDown     = true;
     cboDepartureStation.BackColor       = SystemColors.Window;
     foreach (SwissTransport.Station station in transport.GetStations(cboDepartureStation.Text).StationList)
     {
         if (station.Name != null)
         {
             cboDepartureStation.Items.Add(station.Name);
         }
     }
 }
示例#3
0
        private void On_Text_Changed_Nach(object sender, EventArgs e)
        {
            string ankunft = txtAnkunft.Text;

            transport = new SwissTransport.Transport();

            libVorschlagNach.Items.Clear();

            var stationNach = transport.GetStations(ankunft).StationList;

            for (int i = 0; i < stationNach.Count - 1; i++)
            {
                string ausgabeNach = stationNach[i].Name;
                try
                {
                    libVorschlagNach.Items.Add(ausgabeNach);
                }catch (System.ArgumentNullException)
                {
                    txtAnkunft.Text = txtAnkunft.Text.Substring(0, txtAnkunft.Text.Length - 1);
                    txtAnkunft.Select(txtAnkunft.Text.Length, 0);
                }
            }
        }
示例#4
0
        private void On_Text_Changed_Station(object sender, EventArgs e)
        {
            string station = txtStation.Text;

            transport = new SwissTransport.Transport();

            libVorschlagStation.Items.Clear();

            var stationFahrplan = transport.GetStations(station).StationList;

            for (int i = 0; i < stationFahrplan.Count - 1; i++)
            {
                string ausgabeStation = stationFahrplan[i].Name;
                try
                {
                    libVorschlagStation.Items.Add(ausgabeStation);
                }
                catch (System.ArgumentNullException)
                {
                    txtStation.Text = txtStation.Text.Substring(0, txtStation.Text.Length - 1);
                    txtStation.Select(txtStation.Text.Length, 0);
                }
            }
        }