private void contextItemCopy_Click(object sender, System.EventArgs e) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; if (node is SavedObjectTreeNode) { SavedTemplateInput input = node.Tag as SavedTemplateInput; SavedTemplateInput copy = input.Copy(); SortedProjectTreeNode moduleNode = node.Parent as SortedProjectTreeNode; ZeusModule module = moduleNode.Tag as ZeusModule; string copyName = copy.SavedObjectName; string newName = copyName; int count = 1; bool found; do { found = false; foreach (SavedTemplateInput tmp in module.SavedObjects) { if (tmp.SavedObjectName == newName) { found = true; newName = copyName + " " + count++; break; } } } while (found); copy.SavedObjectName = newName; module.SavedObjects.Add(copy); SavedObjectTreeNode copiedNode = new SavedObjectTreeNode(copy); moduleNode.AddSorted(copiedNode); this._isDirty = true; } }
private void contextItemAddSavedObject_Click(object sender, System.EventArgs e) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; if ((node is ModuleTreeNode) || (node is ProjectTreeNode)) { ZeusModule module = node.Tag as ZeusModule; SavedTemplateInput savedInput = new SavedTemplateInput(); this.formEditSavedObject.Module = module; this.formEditSavedObject.SavedObject = savedInput; if (this.formEditSavedObject.ShowDialog() == DialogResult.OK) { this._isDirty = true; module.SavedObjects.Add(savedInput); SavedObjectTreeNode newNode = new SavedObjectTreeNode(savedInput); node.AddSorted(newNode); node.Expand(); this.treeViewProject.SelectedNode = newNode; } } }
private void contextItemAddSavedObject_Click(object sender, System.EventArgs e) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; if ((node is ModuleTreeNode) || (node is ProjectTreeNode)) { ZeusModule module = node.Tag as ZeusModule; SavedTemplateInput savedInput = new SavedTemplateInput(); this._formEditSavedObject.Module = module; this._formEditSavedObject.SavedObject = savedInput; if (this._formEditSavedObject.ShowDialog() == DialogResult.OK) { this._isDirty = true; module.SavedObjects.Add(savedInput); SavedObjectTreeNode newNode = new SavedObjectTreeNode(savedInput); node.AddSorted(newNode); node.Expand(); this.treeViewProject.SelectedNode = newNode; } } }