private void AddTestParameter(Document.TestParameter parameter, TreeNode containerNode, bool refreshParent) { // 1. If the container node is not provided, we must find it first if (containerNode == null) { TreeNode testNode = treeView.Nodes.Find(parameter.Parent.ID.ToString(), true)[0]; if (Settings.Default.ShowTestParametersInFolders) { containerNode = testNode.Nodes.Find("Parameters", false)[0]; } else { containerNode = testNode; } } TreeNode parameterNode = new TreeNode(parameter.DisplayName); parameterNode.Tag = parameter; parameterNode.ImageKey = parameterNode.SelectedImageKey = (parameter.IsValid ? "parameter" : "parameter_invalid"); parameterNode.Name = parameter.ID.ToString(); parameterNode.ToolTipText = parameter.ErrorMessage; containerNode.Nodes.Add(parameterNode); //parameterNode.ContextMenuStrip = ctxTestParameter; if (refreshParent) { RefreshTest(parameter.Parent as Document.AutomatedTest); } }
private void RemoveTestParameter(Document.TestParameter parameter) { TreeNode parameterNode = treeView.Nodes.Find(parameter.ID.ToString(), true)[0]; parameterNode.Parent.Nodes.Remove(parameterNode); RefreshTest(parameter.Parent as Document.AutomatedTest); }
private void ctxTestParameterDelete_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.TestParameter parameter = treeView.SelectedNode.Tag as Document.TestParameter; Document.AutomatedTest test = parameter.Parent as Document.AutomatedTest; test.Parameters.Remove(parameter); } }
private void RefreshTestParameter(Document.TestParameter parameter) { TreeNode parameterNode = treeView.Nodes.Find(parameter.ID.ToString(), true)[0]; parameterNode.Text = parameter.DisplayName; parameterNode.ImageKey = parameterNode.SelectedImageKey = (parameter.IsValid ? "parameter" : "parameter_invalid"); parameterNode.ToolTipText = parameter.ErrorMessage; RefreshTest(parameter.Parent as Document.AutomatedTest); }