public void OnDelete(object sender, EventArgs e) { if (DoD.IsItemInUse) { MessageBox.Show(string.Format("The {0} {1} is currently in use and cannot be deleted. Before you can delete this {1}," + " you must delete all GCD project items that refer to this {1} before it can be deleted.", DoD.Name, DoD.Noun), string.Format("{0} In Use", DoD.Noun), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show(string.Format("Are you sure that you want to delete the {0} {1}? The {0} {1} and all its underlying data will be deleted permanently.", DoD.Name, DoD.Noun), Properties.Resources.ApplicationNameLong, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } try { // Grab the PArent so we can reload the children after the delete ChangeDetectionGroup cdPArent = (ChangeDetectionGroup)Parent.Parent; DoD.Delete(); Remove(); cdPArent.LoadChildNodes(); } catch (IOException ex) { string processes = string.Empty; if (ex.Data.Contains("Locks")) { MessageBox.Show(string.Format("The following files are being used by other process." + " Close all applications that are using these files and try to delete this {0} again.\n\n{1}", NounSingle.ToLower(), ex.Data["Locks"]), "File Locked", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (ex.Data.Contains("Processes")) { processes = string.Format(" ({0})", ex.Data["Processes"]); MessageBox.Show(string.Format("One or more files belonging to this {0} are being used by another process{1}." + " Close all applications that are using these files and try to delete this {0} again.", NounSingle.ToLower(), processes), "File Locked", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { GCDException.HandleException(ex); } }
public override void LoadChildNodes() { Nodes.Clear(); TreeNodeGroup nodInpt = new GenericNodeGroup(Nodes, "Inputs", "Input", "Inputs", ProjectManager.Project.InputsFolder, ContextMenuStrip.Container, true); TreeNodeGroup nodSurv = new DEMSurveysGroup(nodInpt.Nodes, ContextMenuStrip.Container); TreeNodeGroup nodRefs = new ReferenceSurfaceGroup(nodInpt.Nodes, ContextMenuStrip.Container); TreeNodeGroup nodMask = new MasksGroup(nodInpt.Nodes, ContextMenuStrip.Container); TreeNodeGroup nodRout = new ProfileRouteGroup(nodInpt.Nodes, ContextMenuStrip.Container); TreeNodeGroup nodAnal = new GenericNodeGroup(Nodes, "Analyses", "Analysis", "Analyses", ProjectManager.Project.AnalysesFolder, ContextMenuStrip.Container, true); TreeNodeGroup nodChng = new ChangeDetectionGroup(nodAnal.Nodes, ContextMenuStrip.Container); TreeNodeGroup nodIntr = new InterComparisonGroup(nodAnal.Nodes, ContextMenuStrip.Container); // Inputs and analyses nodes have no right click menu items nodInpt.ContextMenuStrip.Items.Clear(); nodAnal.ContextMenuStrip.Items.Clear(); nodInpt.Expand(); nodAnal.Expand(); Expand(); }