public static void AddDockingMenuItems(ContextMenuStrip menu, ServerBase server) { bool isConnected = server.IsConnected; bool isClientFullScreen = server.IsClientFullScreen; ToolStripMenuItem toolStripMenuItem = new DelegateMenuItem("全屏", MenuNames.SessionFullScreen, delegate { ServerTree.Instance.SelectedNode = server; server.GoFullScreen(); }); toolStripMenuItem.Enabled = (isConnected && !isClientFullScreen); menu.Items.Add(toolStripMenuItem); toolStripMenuItem = new DelegateMenuItem("取消停靠", MenuNames.SessionUndock, server.Undock); toolStripMenuItem.Enabled = (server.IsClientDocked && !isClientFullScreen); menu.Items.Add(toolStripMenuItem); toolStripMenuItem = new DelegateMenuItem("取消停靠并连接", MenuNames.SessionUndockAndConnect, delegate { server.Undock(); server.Connect(); }); toolStripMenuItem.Enabled = (server.IsClientDocked && !isConnected && !isClientFullScreen); menu.Items.Add(toolStripMenuItem); toolStripMenuItem = new DelegateMenuItem("停靠", MenuNames.SessionDock, server.Dock); toolStripMenuItem.Enabled = server.IsClientUndocked; menu.Items.Add(toolStripMenuItem); }
protected override void OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e) { base.OnNodeMouseDoubleClick(e); if (e.Button == MouseButtons.Left && !Helpers.IsControlKeyPressed) { ServerBase serverBase = base.SelectedNode as ServerBase; if (serverBase != null) { serverBase.Connect(); SetDelayedFocusServer(serverBase); } } }