private void LocationListEditButton_Click(object sender, RoutedEventArgs e) { var listWindow = new ListWindow(XManager.AllLocations, XManager.DefaultLocation); var result = listWindow.ShowDialog(); if (result == true) { XManager.UpdateLocations(listWindow.Locations); Locations = new ObservableCollection <Location>(listWindow.Locations); CityList.ItemsSource = null; CityList.ItemsSource = Locations; if (listWindow.DefaultLocation != XManager.DefaultLocation) { XManager.SetDefaultLocation(listWindow.DefaultLocation); } if (Locations.Contains(SelectedLocation)) { CityList.SelectedIndex = Locations.IndexOf(SelectedLocation); } else { CityList.SelectedIndex = Locations.IndexOf(XManager.DefaultLocation); } SelectedLocationChanged(); } }
private void SetDefaultButton_Click(object sender, RoutedEventArgs e) { XManager.SetDefaultLocation((Location)CityList.SelectedItem); SetDefaultButton.IsEnabled = false; }