/// <summary> /// Deletes a folder from the Project, and possibly from the filesystem also. /// </summary> /// <param name="folder">The folder to Delete</param> public void DeleteFolder(Folder folder) { DialogResult msgRes = Util.ShowQuestion( "Do you want to remove the physical folder from the hard drive?\nYes: Remove both Project Reference and Physical Folder\nNo: Remove Project Reference and leave Physical Folder\nCancel: Cancel File Operation"); if (msgRes == DialogResult.Yes) { // Remove the TreeNode folder.Node.Remove(); // Remove physical file Directory.Delete(folder.FullName(), true); // Remove the project reference if (folder.Parent == null) // Remove from Project Project.Folders.Remove(folder); else // Remove from the parent folder folder.Parent.Folders.Remove(folder); } else if (msgRes == DialogResult.No) { folder.Node.Remove(); // Remove just the project reference if (folder.Parent == null) // Remove from Project Project.Folders.Remove(folder); else // Remove from the parent folder folder.Parent.Folders.Remove(folder); } }