private void lvChildNodes_MouseDoubleClick(object sender, MouseEventArgs e) { ListView lvSender = sender as ListView; if (lvSender != null) { ListViewHitTestInfo hti = lvSender.HitTest(e.X, e.Y); if (hti != null && hti.Item != null) { ListViewItem lvItem = hti.Item; if (!lvItem.Selected) { lvItem.Selected = true; } if (lvItem.Tag != null) { LACTreeNode pluginnode = lvItem.Tag as LACTreeNode; ContextMenu contextmenu = null; if (pluginnode != null) { lmctreeview.SelectedNode = pluginnode; lmctreeview.Select(); if (e.Button == MouseButtons.Right) { IPlugIn plugin = pluginnode.Plugin; contextmenu = plugin.GetTreeContextMenu(pluginnode); } else if (e.Button == MouseButtons.Left) { if (pluginnode.Nodes.Count != 0) { pluginnode.sc.manage.ShowControl(pluginnode); } else { IPlugIn plugin = pluginnode.Plugin; contextmenu = plugin.GetTreeContextMenu(pluginnode); } } } if (contextmenu != null) { contextmenu.Show(lvSender, new Point(e.X, e.Y)); } else { Logger.Log( "ConsolePage::lvChildNodes_MouseDoubleClick, menu == null", Logger.manageLogLevel); } } } } }
private void lvChildNodes_MouseUp(object sender, MouseEventArgs e) { ListView lvSender = sender as ListView; if (lvSender != null && e.Button == MouseButtons.Right) { ListViewHitTestInfo hti = lvSender.HitTest(e.X, e.Y); if (hti != null && hti.Item != null) { ListViewItem lvItem = hti.Item; ContextMenu menu = null; if (!lvItem.Selected) { lvItem.Selected = true; } if (lvItem.Tag != null) { if (e.Button == MouseButtons.Right) { LACTreeNode pluginnode = lvItem.Tag as LACTreeNode; IPlugIn plugin = pluginnode.Plugin; menu = plugin.GetTreeContextMenu(pluginnode); } } if (menu != null) { menu.Show(lvSender, new Point(e.X, e.Y)); } else { Logger.Log( "ConsolePage::lvChildNodes_MouseUp, menu == null", Logger.manageLogLevel); } } } }