private void LoadModule(SortedProjectTreeNode parentNode, ZeusModule parentModule) { SortedProjectTreeNode node; if ((parentNode == null) && (parentModule is ZeusProject)) { rootNode = new ProjectTreeNode(parentModule as ZeusProject); node = rootNode; } else { node = new ModuleTreeNode(parentModule); parentNode.AddSorted(node); } foreach (ZeusModule module in parentModule.ChildModules) { LoadModule(node, module); } foreach (SavedTemplateInput input in parentModule.SavedObjects) { node.AddSorted(new SavedObjectTreeNode(input)); } }
private void LoadModule(SortedProjectTreeNode parentNode, ZeusModule childModule) { ModuleTreeNode childNode = new ModuleTreeNode(childModule); parentNode.AddSorted(childNode); foreach (ZeusModule grandchildModule in childModule.ChildModules) { LoadModule(childNode, grandchildModule); } foreach (SavedTemplateInput input in childModule.SavedObjects) { childNode.AddSorted(new SavedObjectTreeNode(input)); } }
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 toolStripButtonEdit_Click(object sender, EventArgs e) { TreeNode node = this.treeViewProject.SelectedNode; SavedTemplateInput input = node.Tag as SavedTemplateInput; ZeusModule parentMod = node.Parent.Tag as ZeusModule; this.formEditSavedObject.Module = parentMod; this.formEditSavedObject.SavedObject = input; if (this.formEditSavedObject.ShowDialog() == DialogResult.OK) { this._isDirty = true; node.Text = input.SavedObjectName; SortedProjectTreeNode parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); } } }
private void contextItemAddModule_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; ZeusModule newmodule = new ZeusModule(); this.formEditModule.Module = newmodule; if (this.formEditModule.ShowDialog() == DialogResult.OK) { this._isDirty = true; module.ChildModules.Add(newmodule); ModuleTreeNode newNode = new ModuleTreeNode(newmodule); node.AddSorted(newNode); node.Expand(); } } }
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 LoadModule(SortedProjectTreeNode parentNode, ZeusModule parentModule) { SortedProjectTreeNode node; if ((parentNode == null) && (parentModule is ZeusProject)) { rootNode = new ProjectTreeNode(parentModule as ZeusProject); node = rootNode; } else { node = new ModuleTreeNode(parentModule); parentNode.AddSorted(node); } foreach (ZeusModule module in parentModule.ChildModules) { LoadModule(node, module); } foreach (SavedTemplateInput input in parentModule.SavedObjects) { node.AddSorted( new SavedObjectTreeNode(input) ); } }