private void AddAlert(Document.Alert alert, 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(alert.Parent.ID.ToString(), true)[0]; if (Settings.Default.ShowAlertsInFolders) { containerNode = testNode.Nodes.Find("Alerts", false)[0]; } else { containerNode = testNode; } } TreeNode alertNode = new TreeNode(alert.DisplayName); alertNode.Tag = alert; alertNode.ImageKey = alertNode.SelectedImageKey = (alert.IsValid ? "alert" : "alert_invalid"); alertNode.Name = alert.ID.ToString(); alertNode.ToolTipText = alert.ErrorMessage; containerNode.Nodes.Add(alertNode); //parameterNode.ContextMenuStrip = ctxTestParameter; if (refreshParent) { RefreshTest(alert.Parent as Document.AutomatedTest); } }
private void RemoveAlert(Document.Alert alert) { TreeNode alertNode = treeView.Nodes.Find(alert.ID.ToString(), true)[0]; alertNode.Parent.Nodes.Remove(alertNode); RefreshTest(alert.Parent as Document.AutomatedTest); }
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 RefreshAlert(Document.Alert alert) { TreeNode alertNode = treeView.Nodes.Find(alert.ID.ToString(), true)[0]; alertNode.Text = alert.DisplayName; alertNode.ImageKey = alertNode.SelectedImageKey = (alert.IsValid ? "alert" : "alert_invalid"); alertNode.ToolTipText = alert.ErrorMessage; RefreshTest(alert.Parent as Document.AutomatedTest); }