private void RemoveTest(Document.AutomatedTest test) { TreeNode testNode = treeView.Nodes.Find(test.ID.ToString(), true)[0]; testNode.Parent.Nodes.Remove(testNode); RefreshTarget(test.Parent as Document.Target); }
private void ctxAlertDelete_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Are you sure you want to delete '" + treeView.SelectedNode.Text + "'?", "Confirm deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Document.Alert alert = treeView.SelectedNode.Tag as Document.Alert; Document.AutomatedTest test = alert.Parent as Document.AutomatedTest; test.Alerts.Remove(alert); } }
private void RefreshTest(Document.AutomatedTest test) { TreeNode testNode = treeView.Nodes.Find(test.ID.ToString(), true)[0]; testNode.Text = test.DisplayName; testNode.ImageKey = testNode.SelectedImageKey = (test.IsValid ? "test" : "test_invalid"); testNode.Name = test.ID.ToString(); testNode.ToolTipText = test.ErrorMessage; RefreshTarget(test.Parent as Document.Target); }
private void ctxTestAddAlert_Click(object sender, EventArgs e) { Document.AutomatedTest test = treeView.SelectedNode.Tag as Document.AutomatedTest; Document.Alert newAlert = new TigerClient.Document.Alert(); test.Alerts.Add(newAlert); TreeNode[] findNodes = treeView.Nodes.Find(newAlert.ID.ToString(), true); if (findNodes.Length != 0) { treeView.SelectedNode = findNodes[0]; } }
private void ctxTestAddTestParameter_Click(object sender, EventArgs e) { Document.AutomatedTest test = treeView.SelectedNode.Tag as Document.AutomatedTest; Document.TestParameter newTestParameter = new TigerClient.Document.TestParameter(); test.Parameters.Add(newTestParameter); TreeNode[] findNodes = treeView.Nodes.Find(newTestParameter.ID.ToString(), true); if (findNodes.Length != 0) { treeView.SelectedNode = findNodes[0]; } }
private void ClearChildNodesTest(Document.AutomatedTest test, string collectionName) { if (collectionName == "Parameters") { TreeNode parametersContainer = treeView.Nodes.Find(test.ID.ToString(), true)[0]; if (Settings.Default.ShowTestParametersInFolders) { parametersContainer = parametersContainer.Nodes.Find("Parameters", false)[0]; } parametersContainer.Nodes.Clear(); //RefreshTest(test); } else if (collectionName == "Alerts") { TreeNode testNode = treeView.Nodes.Find(test.ID.ToString(), true)[0]; if (Settings.Default.ShowAlertsInFolders) { TreeNode alertsContainer = testNode.Nodes.Find("Alerts", false)[0]; alertsContainer.Nodes.Clear(); } else { List <TreeNode> nodesToRemove = new List <TreeNode>(); foreach (TreeNode child in testNode.Nodes) { if (child.Tag is Document.Alert) { nodesToRemove.Add(child); } } foreach (TreeNode nodeToRemove in nodesToRemove) { testNode.Nodes.Remove(nodeToRemove); } } } RefreshTest(test); }
private void ctxTestTestRun_Click(object sender, EventArgs e) { try { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; Document.AutomatedTest test = treeView.SelectedNode.Tag as Document.AutomatedTest; //if (test != null) test.Run(true); if (test != null) { Utilities.frmSingleTestRunner f = new TigerClient.Utilities.frmSingleTestRunner(); f.Run(test); } System.Windows.Forms.Cursor.Current = Cursors.Default; } catch (Exception ex) { System.Windows.Forms.Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); } }
private void AddTest(Document.AutomatedTest test, TreeNode containerNode, bool refreshParent) { // 1. If the container node is not provided, we must find it first if (containerNode == null) { TreeNode targetNode = treeView.Nodes.Find(test.Parent.ID.ToString(), true)[0]; if (Settings.Default.ShowTestsInFolders) { containerNode = targetNode.Nodes.Find("Automated Tests", false)[0]; } else { containerNode = targetNode; } } TreeNode testNode = new TreeNode(test.DisplayName); testNode.Tag = test; testNode.ImageKey = testNode.SelectedImageKey = (test.IsValid ? "test" : "test_invalid"); testNode.Name = test.ID.ToString(); testNode.ToolTipText = test.ErrorMessage; //testNode.ContextMenuStrip = ctxTest; containerNode.Nodes.Add(testNode); // Parameters TreeNode parametersContainer = testNode; if (Settings.Default.ShowTestParametersInFolders) { parametersContainer = testNode.Nodes.Add("Parameters"); parametersContainer.ImageKey = parametersContainer.SelectedImageKey = "folder_closed"; parametersContainer.Name = "Parameters"; } foreach (Document.TestParameter parameter in test.Parameters) { AddTestParameter(parameter, parametersContainer, false); } // Alerts TreeNode alertsContainer = testNode; if (Settings.Default.ShowAlertsInFolders) { alertsContainer = testNode.Nodes.Add("Alerts"); alertsContainer.ImageKey = alertsContainer.SelectedImageKey = "folder_closed"; alertsContainer.Name = "Alerts"; } foreach (Document.Alert alert in test.Alerts) { AddAlert(alert, alertsContainer, false); } if (refreshParent) { RefreshTarget(test.Parent as Document.Target); } }
public void Run(Document.AutomatedTest test) { Test = test; ShowDialog(); }
public TestCompletedEventArgs(Document.AutomatedTest test) { this.test = test; }