private void Button_AcceptRename(object sender, RoutedEventArgs e) { //check for forbidden strings if (this.IndexCardNewName.Text == "Options" || this.IndexCardNewName.Text == "Folders" || this.IndexCardNewName.Text == "Fonts" || this.IndexCardNewName.Text == "Windowposition") { MessageBox.Show(Globals.MultilangManager.GetTranslation("Error : Name is already used"), "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } //check if name is already used. This would cause issues when saving IndexCard RenameWho = Globals.FolderManager.IndexCardGet(EditedGUID); IndexCard AlreadyTaken = Globals.FolderManager.IndexCardGet(this.IndexCardNewName.Text); if (AlreadyTaken != null && AlreadyTaken != RenameWho) { MessageBox.Show(Globals.MultilangManager.GetTranslation("Error : Name is already used"), "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (RenameWho != null) { RenameWho.SetName(this.IndexCardNewName.Text); } this.Close(); }
/// <summary> /// Create a default index card and append it to the list of index cards /// </summary> public void AppendIndexCard() { IndexCard nc = new IndexCard(GeneralSettings); nc.SetVisible(false); nc.SetName("Unsaved " + IndexCards.Count.ToString()); IndexCards.Add(nc); }
private void Button_AcceptRename(object sender, RoutedEventArgs e) { RenameWho.SetName(this.IndexCardNewName.Text); this.Close(); }