public void Execute() { Cursor.Current = Cursors.WaitCursor; TreeNode node = this.treeViewProject.SelectedNode; DefaultSettings settings = DefaultSettings.Instance; ProjectExecuteStatus log = new ProjectExecuteStatus(); log.Show(this); if ((node is ModuleTreeNode) || (node is ProjectTreeNode)) { ZeusModule module = node.Tag as ZeusModule; module.Execute(settings.ScriptTimeout, log); } else if (node is SavedObjectTreeNode) { SavedTemplateInput savedinput = node.Tag as SavedTemplateInput; savedinput.Execute(settings.ScriptTimeout, log); } log.Finished = true; log.BringToFront(); log.Activate(); Cursor.Current = Cursors.Default; }
private void contextItemRemove_Click(object sender, System.EventArgs e) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; SortedProjectTreeNode parentnode; if (node is ModuleTreeNode) { parentnode = node.Parent as SortedProjectTreeNode; ZeusModule parentmodule = parentnode.Tag as ZeusModule; ZeusModule module = node.Tag as ZeusModule; parentmodule.ChildModules.Remove(module); parentnode.Nodes.Remove(node); this._isDirty = true; } else if (node is SavedObjectTreeNode) { parentnode = node.Parent as SortedProjectTreeNode; ZeusModule parentmodule = parentnode.Tag as ZeusModule; SavedTemplateInput savedobj = node.Tag as SavedTemplateInput; parentmodule.SavedObjects.Remove(savedobj); parentnode.Nodes.Remove(node); this._isDirty = true; } }
private void treeViewProject_OnDoubleClick(object sender, System.EventArgs e) { SortedProjectTreeNode parentnode; TreeNode node = this.treeViewProject.SelectedNode; if (node is SavedObjectTreeNode) { 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; parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); this.treeViewProject.SelectedNode = node; } } } }
public void Execute() { this.Save(); ZeusProject proj = this._rootNode.Project; Cursor.Current = Cursors.WaitCursor; TreeNode node = this.treeViewProject.SelectedNode; DefaultSettings settings = DefaultSettings.Instance; if (node is ProjectTreeNode) { OnExecutionStarted(); ZeusProcessManager.ExecuteProject(proj.FilePath, ExecutionCallback); } else if (node is ModuleTreeNode) { ZeusModule module = node.Tag as ZeusModule; OnExecutionStarted(); ZeusProcessManager.ExecuteModule(proj.FilePath, module.ProjectPath, ExecutionCallback); //module.Execute(settings.ScriptTimeout, log); } else if (node is SavedObjectTreeNode) { SavedTemplateInput savedinput = node.Tag as SavedTemplateInput; ZeusModule module = node.Parent.Tag as ZeusModule; OnExecutionStarted(); ZeusProcessManager.ExecuteProjectItem(proj.FilePath, module.ProjectPath + "/" + savedinput.SavedObjectName, ExecutionCallback); //savedinput.Execute(settings.ScriptTimeout, log); } }
public SavedObjectTreeNode(SavedTemplateInput templateInput) { this.Tag = templateInput; this.ForeColor = Color.Blue; this.Text = templateInput.SavedObjectName; this.ImageIndex = 6; this.SelectedImageIndex = 6; }
public void Edit(bool allowEditFolders) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; SortedProjectTreeNode parentnode; if (allowEditFolders && ((node is ModuleTreeNode) || (node is ProjectTreeNode))) { ZeusModule module = node.Tag as ZeusModule; this._formEditModule.Module = module; if (this._formEditModule.ShowDialog() == DialogResult.OK) { this._isDirty = true; node.Text = module.Name; parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); this.treeViewProject.SelectedNode = node; } if (node is ProjectTreeNode) { OnTextChanged("Project: " + module.Name, module.Name, _rootNode.Project.FilePath); } } } else if (node is SavedObjectTreeNode) { if (_collectInChildProcess) { Save(); } 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; parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); this.treeViewProject.SelectedNode = node; } } } }
private void contextItemEdit_Click(object sender, System.EventArgs e) { SortedProjectTreeNode node = this.treeViewProject.SelectedNode as SortedProjectTreeNode; SortedProjectTreeNode parentnode; if ((node is ModuleTreeNode) || (node is ProjectTreeNode)) { ZeusModule module = node.Tag as ZeusModule; this.formEditModule.Module = module; if (this.formEditModule.ShowDialog() == DialogResult.OK) { this._isDirty = true; node.Text = module.Name; parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); this.treeViewProject.SelectedNode = node; } if (node is ProjectTreeNode) { this.Text = "Project: " + module.Name; this.TabText = module.Name; } } } else if (node is SavedObjectTreeNode) { 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; parentnode = node.Parent as SortedProjectTreeNode; if (parentnode != null) { node.Remove(); parentnode.AddSorted(node); this.treeViewProject.SelectedNode = node; } } } }
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; } } }
public string ReadXML(XmlTextReader xr) { string tagName = string.Empty; bool inStartElement, inEmptyElement, skipread = false; this.Name = xr.GetAttribute("name"); this.Description = xr.GetAttribute("description"); string tmp = xr.GetAttribute("defaultSettingsOverride"); if (!string.IsNullOrEmpty(tmp)) { this.DefaultSettingsOverride = Convert.ToBoolean(tmp); } inEmptyElement = xr.IsEmptyElement; if (!inEmptyElement) { while ((skipread) || (xr.Read())) { inStartElement = xr.IsStartElement(); inEmptyElement = xr.IsEmptyElement; if (skipread) { skipread = false; } else { tagName = xr.LocalName; } if (inStartElement) { // a module start if (tagName == "module") { ZeusModule module = new ZeusModule(); tagName = module.ReadXML(xr); skipread = true; module.SetParentModule(this); this.ChildModules.Add(module); } // a saved item start else if (tagName == "item") { InputItem item = new InputItem(); item.ReadXML(xr); this.SavedItems.Add(item); } // a saved object start else if (tagName == "obj") { SavedTemplateInput input = new SavedTemplateInput(); tagName = input.ReadXML(xr); skipread = true; this.SavedObjects.Add(input); } } else { // if not in a sub module and this is an end module tag, break! if (tagName == "module") { break; } } } } xr.Read(); inStartElement = xr.IsStartElement(); tagName = xr.LocalName; return(tagName); }
public string ReadXML(XmlTextReader xr) { string tagName = string.Empty; bool inStartElement, inEmptyElement, skipread = false; this.Name = xr.GetAttribute("name"); this.Description = xr.GetAttribute("description"); string tmp = xr.GetAttribute("defaultSettingsOverride"); if (!string.IsNullOrEmpty(tmp)) { this.DefaultSettingsOverride = Convert.ToBoolean(tmp); } inEmptyElement = xr.IsEmptyElement; if (!inEmptyElement) { while ( (skipread) || (xr.Read()) ) { inStartElement = xr.IsStartElement(); inEmptyElement = xr.IsEmptyElement; if (skipread) { skipread = false; } else { tagName = xr.LocalName; } if (inStartElement) { // a module start if (tagName == "module") { ZeusModule module = new ZeusModule(); tagName = module.ReadXML(xr); skipread = true; module.SetParentModule(this); this.ChildModules.Add(module); } // a saved item start else if (tagName == "item") { InputItem item = new InputItem(); item.ReadXML(xr); this.SavedItems.Add(item); } // a saved object start else if (tagName == "obj") { SavedTemplateInput input = new SavedTemplateInput(); tagName = input.ReadXML(xr); skipread = true; this.SavedObjects.Add(input); } } else { // if not in a sub module and this is an end module tag, break! if (tagName == "module") { break; } } } } xr.Read(); inStartElement = xr.IsStartElement(); tagName = xr.LocalName; return tagName; }