protected virtual void OnNodeMouseDoubleClick(VirtualTreeNodeMouseClickEventArgs e) { EventHandler <VirtualTreeNodeMouseClickEventArgs> handler = NodeMouseDoubleClick; if (handler != null) { handler(this, e); } }
// 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()); Assert.IsTrue(SelectInTree(ixmo), "Couldn't find a node for " + ixmoString + " in the tree"); MW(() => { var tree = TestUtils.GetFlickerFreeTreeView(MainWindowWrapper.Item, "navigationPane.navigationView.treeView"); // Generate the TreeContextMenu var e = new VirtualTreeNodeMouseClickEventArgs(tree.SelectedNode, MouseButtons.Right, 1, 0, 0); var view = TestUtils.GetNavigationView(MainWindowWrapper.Item, "navigationPane.navigationView"); TestUtils.ExecuteMethod(view, "HandleNodeRightClick", new object[] { e }); }); var menu = TestUtils.GetContextMenuStrip(MainWindowWrapper.Item, "navigationPane.navigationView.TreeContextMenu"); AssertToolStripItems(ixmoString, expectedItems, menu.Items, true); // Close the menu again MW(menu.Close); Thread.Sleep(100); }
private void treeView_NodeMouseDoubleClick(object sender, VirtualTreeNodeMouseClickEventArgs e) { if (okButton.Enabled) okButton_Click(sender, null); }
private void treeView_NodeMouseClick(object sender, VirtualTreeNodeMouseClickEventArgs e) { if (e.Button != MouseButtons.Right || e.Node == null) return; Folder folder = e.Node.Tag as Folder; if (folder == null) return; ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem item = new ToolStripMenuItem(Messages.NEW_FOLDER, Resources._000_Folder_open_h32bit_16, newMenuItem_Click); item.Tag = folder; menu.Items.Add(item); menu.Show(treeView, e.Location); }
protected virtual void OnNodeMouseDoubleClick(VirtualTreeNodeMouseClickEventArgs e) { EventHandler<VirtualTreeNodeMouseClickEventArgs> handler = NodeMouseDoubleClick; if (handler != null) { handler(this, e); } }
// 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); }