public static bool CreateNewFolder(string caption, CommandKeyFolder parentFolder, ref string value, ref bool inRoot) { NewFolderName newFolderName = new NewFolderName(); newFolderName.Text = caption; newFolderName.RootFolder = newFolderName.GetRootFolder(parentFolder); newFolderName.ParentFolder = parentFolder; newFolderName.CreateInRoot = (newFolderName.ParentFolder == null || newFolderName.ParentFolder == newFolderName.RootFolder); bool needToUpdateRootFlag = (newFolderName.chkRoot.Enabled == (newFolderName.ParentFolder != newFolderName.RootFolder)); newFolderName.chkRoot.Enabled = (newFolderName.ParentFolder != newFolderName.RootFolder); if (needToUpdateRootFlag) { newFolderName.UpdateRootCheckedValue(); } newFolderName.FolderName = value; if (newFolderName.ShowDialog() == DialogResult.OK) { value = newFolderName.FolderName; inRoot = newFolderName.CreateInRoot; return(true); } else { return(false); } }
public static bool RenameFolder(string caption, CommandKeyFolder parentFolder, ref string value) { NewFolderName newFolderName = new NewFolderName(); newFolderName.Text = caption; newFolderName.chkRoot.Visible = false; newFolderName.RootFolder = null; newFolderName.ParentFolder = parentFolder; newFolderName.GetExistingFolders(newFolderName.ParentFolder); newFolderName.FolderName = value; if (newFolderName.ShowDialog() == DialogResult.OK) { value = newFolderName.FolderName; return(true); } else { return(false); } }