private async void renameButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(this.nameBox.Text)) { MessageBox.Show(AppResources.RenameEmptyString, AppResources.ErrorCaption, MessageBoxButton.OK); } else { if (this.nameBox.Text.ToLower().Equals(this.entry.DisplayName.ToLower())) { return; } if (this.db.IsDisplayNameUnique(this.nameBox.Text)) { this.entry.DisplayName = this.nameBox.Text; this.db.CommitChanges(); MainPage.shouldRefreshAllROMList = true; //only need to manually referesh the rom list because colectionviewsource does not update sorting FileHandler.UpdateROMTile(this.entry.FileName); //update voice command list await MainPage.UpdateGameListForVoiceCommand(); this.NavigationService.GoBack(); } else { MessageBox.Show(AppResources.RenameNameAlreadyExisting, AppResources.ErrorCaption, MessageBoxButton.OK); } } }
private void renameButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(this.nameBox.Text)) { MessageBox.Show(AppResources.RenameEmptyString, AppResources.ErrorCaption, MessageBoxButton.OK); } else { if (this.nameBox.Text.ToLower().Equals(this.entry.DisplayName.ToLower())) { return; } if (this.db.IsDisplayNameUnique(this.nameBox.Text)) { this.entry.DisplayName = this.nameBox.Text; this.db.CommitChanges(); FileHandler.UpdateROMTile(this.entry.FileName); this.NavigationService.GoBack(); } else { MessageBox.Show(AppResources.RenameNameAlreadyExisting, AppResources.ErrorCaption, MessageBoxButton.OK); } } }
private void RenameListEntry(object sender, ListBox list) { ListBoxItem contextMenuListItem = list.ItemContainerGenerator.ContainerFromItem((sender as MenuItem).DataContext) as ListBoxItem; ROMDBEntry re = contextMenuListItem.DataContext as ROMDBEntry; InputPrompt prompt = new InputPrompt(); prompt.Completed += (o, e2) => { if (e2.PopUpResult == PopUpResult.Ok) { if (String.IsNullOrWhiteSpace(e2.Result)) { MessageBox.Show(AppResources.RenameEmptyString, AppResources.ErrorCaption, MessageBoxButton.OK); } else { if (e2.Result.ToLower().Equals(re.DisplayName.ToLower())) { return; } if (this.db.IsDisplayNameUnique(e2.Result)) { re.DisplayName = e2.Result; this.db.CommitChanges(); FileHandler.UpdateROMTile(re.FileName); } else { MessageBox.Show(AppResources.RenameNameAlreadyExisting, AppResources.ErrorCaption, MessageBoxButton.OK); } } } }; prompt.Title = AppResources.RenamePromptTitle; prompt.Message = AppResources.RenamePromptMessage; prompt.Value = re.DisplayName; prompt.Show(); }