private void RenameFolder() { if (treeView.SelectedNode != null) { var folder = treeView.SelectedNode.Tag as Folder; if (folder == null) { return; } using (var dialog = new InputPromptDialog { Text = Messages.RENAME_FOLDER_TITLE, PromptText = Messages.NEW_FOLDER_NAME, InputText = folder.Name(), HelpID = "NewFolderDialog" }) { if (dialog.ShowDialog(this) != DialogResult.OK) { return; } selectedFolderRef = Folders.AppendPath(folder.Path, dialog.InputText); new RenameFolderCommand(Program.MainWindow, folder, dialog.InputText).Execute(); } } }
/// <summary> /// /// </summary> /// <param name="owner"></param> /// <param name="message"></param> /// <param name="title"></param> /// <param name="defaultInput"></param> /// <returns>null if the user cancelled, otherwise the string they gave.</returns> public static String Prompt(IWin32Window owner, String message, String title, String defaultInput, String helpID) { InputPromptDialog messageBox = new InputPromptDialog(); messageBox.Text = title; messageBox.promptLabel.Text = message; messageBox.textBox1.Text = defaultInput; messageBox.HelpID = helpID; if (messageBox.ShowDialog(owner) == DialogResult.Cancel) return null; return messageBox.textBox1.Text; }
/// <summary> /// /// </summary> /// <param name="owner"></param> /// <param name="message"></param> /// <param name="title"></param> /// <param name="defaultInput"></param> /// <returns>null if the user cancelled, otherwise the string they gave.</returns> public static String Prompt(IWin32Window owner, String message, String title, String defaultInput, String helpID) { InputPromptDialog messageBox = new InputPromptDialog(); messageBox.Text = title; messageBox.promptLabel.Text = message; messageBox.textBox1.Text = defaultInput; messageBox.HelpID = helpID; if (messageBox.ShowDialog(owner) == DialogResult.Cancel) { return(null); } return(messageBox.textBox1.Text); }