private void cbContinent_SelectionChanged(object sender, SelectionChangedEventArgs e) { Continent selectedContinent = (Continent)cbContinent.SelectedItem; cbRegion.Items.Clear(); if (selectedContinent.Uid == "100") { foreach (Region region in Regions.GetAllRegions().OrderBy(r => r.Name)) { cbRegion.Items.Add(region); } } else { if (selectedContinent.Regions.Count > 1) { cbRegion.Items.Add(Regions.GetRegion("100")); } foreach (Region region in selectedContinent.Regions.OrderBy(r => r.Name)) { cbRegion.Items.Add(region); } } cbRegion.SelectedIndex = 0; }
public PageStartData() { InitializeComponent(); Continent continentAll = new Continent("100", "All continents"); cbContinent.Items.Add(continentAll); foreach (Continent continent in Continents.GetContinents()) { cbContinent.Items.Add(continent); } foreach (Region region in Regions.GetAllRegions()) { cbRegion.Items.Add(region); } for (int i = 1960; i < 2014; i++) { cbYear.Items.Insert(0, i); } cbYear.SelectedIndex = 0; cbDifficulty.ItemsSource = DifficultyLevels.GetDifficultyLevels(); foreach (Airline.AirlineFocus focus in Enum.GetValues(typeof(Airline.AirlineFocus))) { cbFocus.Items.Add(focus); } }