private void failedAssumptionsMenuItem_Click(object sender, System.EventArgs e) { TestSuiteTreeNode targetNode = explicitlySelectedNode != null ? explicitlySelectedNode : (TestSuiteTreeNode)SelectedNode; TestSuiteTreeNode theoryNode = targetNode != null?targetNode.GetTheoryNode() : null; if (theoryNode != null) { MenuItem item = (MenuItem)sender; BeginUpdate(); item.Checked = !item.Checked; theoryNode.ShowFailedAssumptions = item.Checked; EndUpdate(); } }
/// <summary> /// Build treeview context menu dynamically on popup /// </summary> private void ContextMenu_Popup(object sender, System.EventArgs e) { this.ContextMenu.MenuItems.Clear(); TestSuiteTreeNode targetNode = explicitlySelectedNode != null ? explicitlySelectedNode : (TestSuiteTreeNode)SelectedNode; if (targetNode == null) { return; } // TODO: handle in Starting event if (Model.IsTestRunning) { runCommandEnabled = false; } MenuItem runMenuItem = new MenuItem("&Run", new EventHandler(runMenuItem_Click)); runMenuItem.DefaultItem = runMenuItem.Enabled = runCommandEnabled && targetNode.Included && (targetNode.Test.RunState == RunState.Runnable || targetNode.Test.RunState == RunState.Explicit); this.ContextMenu.MenuItems.Add(runMenuItem); this.ContextMenu.MenuItems.Add("-"); TestSuiteTreeNode theoryNode = targetNode.GetTheoryNode(); if (theoryNode != null) { MenuItem failedAssumptionsMenuItem = new MenuItem("Show Failed Assumptions", new EventHandler(failedAssumptionsMenuItem_Click)); failedAssumptionsMenuItem.Checked = theoryNode.ShowFailedAssumptions; this.ContextMenu.MenuItems.Add(failedAssumptionsMenuItem); this.ContextMenu.MenuItems.Add("-"); } MenuItem showCheckBoxesMenuItem = new MenuItem("Show CheckBoxes", new EventHandler(showCheckBoxesMenuItem_Click)); showCheckBoxesMenuItem.Checked = this.CheckBoxes; this.ContextMenu.MenuItems.Add(showCheckBoxesMenuItem); this.ContextMenu.MenuItems.Add("-"); MenuItem propertiesMenuItem = new MenuItem( "&Properties", new EventHandler(propertiesMenuItem_Click)); this.ContextMenu.MenuItems.Add(propertiesMenuItem); }