private void OnEditClicked(object sender, RoutedEventArgs e) { if (secretBase == null && IsGBAGame && listViewSecretBases.SelectedIndex == 0) { var location = SecretBaseLocationChooser.Show(Window.GetWindow(this), 0, IsGBAGame ? GBAGameSave.SecretBaseManager : null); if (location.HasValue && location.Value != 0) { GBAGameSave.SecretBaseLocation = location.Value; UpdateListViewItems(); OnSecretBaseSelected(null, null); } } else { SecretBaseEditor.Show(Window.GetWindow(this), secretBase); //UpdateListViewItems(); int newIndex; if (!secretBase.IsPlayerSecretBase) { if (IsGBAGame) { GBAGameSave.SecretBaseManager.Sort(); newIndex = 2 + GBAGameSave.SecretBaseManager.SharedSecretBases.IndexOf((SharedSecretBase)secretBase); } else { PokeManager.SortSecretBases(); newIndex = PokeManager.SecretBases.IndexOf((SharedSecretBase)secretBase); } AddListViewItems(); listViewSecretBases.SelectedIndex = newIndex; OnSecretBaseSelected(null, null); } else { UpdateListViewItems(); OnSecretBaseSelected(null, null); } } }