// In the expected items, represent a separator by a null protected void VerifyContextMenu(object ixmo, ExpectedMenuItem[] expectedItems) { string ixmoString = (ixmo == null ? "XenCenter node" : ixmo.ToString()); // The easiest way to generate the context menu is to call TreeView_NodeMouseClick_ ourselves. // So construct fake click event data. VirtualTreeNode node = FindInTree(ixmo); Assert.IsNotNull(node, "Couldn't find a node for " + ixmoString + " in the tree"); VirtualTreeNodeMouseClickEventArgs e = new VirtualTreeNodeMouseClickEventArgs(node, MouseButtons.Right, 1, 0, 0); // Generate the TreeContextMenu MW(delegate() { node.EnsureVisible(); MainWindowWrapper.TreeView_NodeMouseClick_(MainWindowWrapper.TreeView, e); }); ContextMenuStrip menu = MainWindowWrapper.TreeContextMenu; AssertToolStripItems(ixmoString, expectedItems, menu.Items, true); // Close the menu again MW(menu.Close); Thread.Sleep(100); }
internal override Command CreateCommand() { PutInNavigationMode(NativeMode); _node = GetAllTreeNodes().Find(n => n.Tag is IXenObject && !(n.Tag is Folder) && n.Parent.Tag is Folder); MW(() => _node.EnsureVisible()); return(new RemoveFromFolderCommand(Program.MainWindow, new List <VirtualTreeNode> { _node })); }
internal override Command CreateCommand() { PutInOrgView(ORGANIZATION_VIEW); _node = GetAllTreeNodes().Find(n => n.Tag is IXenObject && !(n.Tag is Folder) && n.Parent.Tag is Folder); MW(() => _node.EnsureVisible()); return(new RemoveFromFolderCommand(Program.MainWindow.CommandInterface, new List <VirtualTreeNode> { _node })); }
internal override Command CreateCommand() { PutInNavigationMode(NativeMode); _node = GetAllTreeNodes().Find(delegate(VirtualTreeNode n) { GroupingTag groupingTag = n.Parent == null ? null : n.Parent.Tag as GroupingTag; if (n.Tag is IXenObject && groupingTag != null && groupingTag.Grouping.GroupingName == "Tags") { _tag = (string)groupingTag.Group; return(true); } return(false); }); MW(() => _node.EnsureVisible()); return(new UntagCommand(Program.MainWindow, new List <VirtualTreeNode> { _node })); }