示例#1
0
        private void OaiTargeControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
                return;

            ContextMenuStrip contextMenu = new ContextMenuStrip();

            ToolStripMenuItem menuItem = null;
            // ToolStripMenuItem subMenuItem = null;

            TreeNode node = this.SelectedNode;

            // 属性
            menuItem = new ToolStripMenuItem("属性(&P)");
            if (node == null
                || (node != null && node.ImageIndex == TYPE_DATABASE))
                menuItem.Enabled = false;
            menuItem.Click += new EventHandler(menuItem_property_Click);
            contextMenu.Items.Add(menuItem);


            /*
            // 新增下级
            menuItem = new ToolStripMenuItem("新增下级(&C)");
            if (node != null && node.ImageIndex == TYPE_DATABASE)
                menuItem.Enabled = false;
            contextMenu.Items.Add(menuItem);

            // 子菜单
            subMenuItem = new ToolStripMenuItem();
            subMenuItem.Text = "目录(&D)";
            subMenuItem.Tag = "dir";
            if (IsServer(node) == true)
                subMenuItem.Enabled = false;
            subMenuItem.Click += new EventHandler(MenuItem_newChild_Click);
            menuItem.DropDown.Items.Add(subMenuItem);

            subMenuItem = new ToolStripMenuItem();
            subMenuItem.Text = "服务器(&S)";
            subMenuItem.Tag = "server";
            if (IsServer(node) == true)
                subMenuItem.Enabled = false;
            subMenuItem.Click += new EventHandler(MenuItem_newChild_Click);
            menuItem.DropDown.Items.Add(subMenuItem);


            // 新增同级
            menuItem = new ToolStripMenuItem("新增同级(&S)");
            if (node == null
                || (node != null && node.ImageIndex == TYPE_DATABASE))
                menuItem.Enabled = false;
            contextMenu.Items.Add(menuItem);

            // 子菜单
            subMenuItem = new ToolStripMenuItem();
            subMenuItem.Text = "目录(&D)";
            subMenuItem.Tag = "dir";
            subMenuItem.Click += new EventHandler(MenuItem_newSibling_Click);
            menuItem.DropDown.Items.Add(subMenuItem);

            subMenuItem = new ToolStripMenuItem();
            subMenuItem.Text = "服务器(&S)";
            subMenuItem.Tag = "server";
            subMenuItem.Click += new EventHandler(MenuItem_newSibling_Click);
            menuItem.DropDown.Items.Add(subMenuItem);


            // 删除
            menuItem = new ToolStripMenuItem("删除(&R)");
            if (node == null)
                menuItem.Enabled = false;
            menuItem.Click += new EventHandler(menuItem_delete_Click);
            contextMenu.Items.Add(menuItem);
             * */


            if (OnSetMenu != null)
            {
                GuiAppendMenuEventArgs newargs = new GuiAppendMenuEventArgs();
                newargs.ContextMenuStrip = contextMenu;
                OnSetMenu(this, newargs);
                if (newargs.ContextMenuStrip != contextMenu)
                    contextMenu = newargs.ContextMenuStrip;
            }


            contextMenu.Show(this, e.Location);
        }
示例#2
0
        private void KernelResTree_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
                return;

            ContextMenu contextMenu = new ContextMenu();
            MenuItem menuItem = null;


            menuItem = new MenuItem("编辑配置文件(&E)");
            menuItem.Click += new System.EventHandler(this.menu_editCfgFile);
            if (this.SelectedNode == null || this.SelectedNode.ImageIndex != RESTYPE_FILE)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

#if NO
            menuItem = new MenuItem("刷新(&R)");
            menuItem.Click += new System.EventHandler(this.menu_refresh);
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);


            menuItem = new MenuItem("导出数据(&E)");
            menuItem.Click += new System.EventHandler(this.menu_export);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("导入数据(&I)");
            menuItem.Click += new System.EventHandler(this.menu_import);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("快速导入数据(&S)");
            menuItem.Click += new System.EventHandler(this.menu_quickImport);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            //
            menuItem = new MenuItem("管理操作");
            contextMenu.MenuItems.Add(menuItem);

            MenuItem subMenuItem = new MenuItem("delete keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_deleteKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);


            subMenuItem = new MenuItem("create keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_createKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("disable keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_disableKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("rebuild keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_rebuildKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("flush pending keys");
            subMenuItem.Click += new System.EventHandler(this.menu_flushKeysCache);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            // 
            menuItem = new MenuItem("允许复选(&M)");
            menuItem.Click += new System.EventHandler(this.menu_toggleCheckBoxes);
            if (this.CheckBoxes == true)
                menuItem.Checked = true;
            else
                menuItem.Checked = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("清除全部复选(&C)");
            menuItem.Click += new System.EventHandler(this.menu_clearCheckBoxes);
            if (this.CheckBoxes == true)
                menuItem.Enabled = true;
            else
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("全选下级节点(&A)");
            menuItem.Click += new System.EventHandler(this.menu_checkAllSubNodes);
            menuItem.Enabled = this.CheckBoxes;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            // 
            menuItem = new MenuItem("在下级创建新目录或文件(&N)");
            menuItem.Click += new System.EventHandler(this.menu_newDirectoryOrFile);
            if (this.SelectedNode != null
                && (this.SelectedNode.ImageIndex == ResTree.RESTYPE_SERVER
                || this.SelectedNode.ImageIndex == ResTree.RESTYPE_DB
                || this.SelectedNode.ImageIndex == ResTree.RESTYPE_FOLDER))
                menuItem.Enabled = true;
            else
                menuItem.Enabled = false;

            contextMenu.MenuItems.Add(menuItem);
#endif

            if (OnSetMenu != null)
            {
                GuiAppendMenuEventArgs newargs = new GuiAppendMenuEventArgs();
                newargs.ContextMenu = contextMenu;
                OnSetMenu(this, newargs);
                if (newargs.ContextMenu != contextMenu)
                    contextMenu = newargs.ContextMenu;
            }

            if (contextMenu != null)
                contextMenu.Show(this, new Point(e.X, e.Y));
        }
示例#3
0
		private void ResRightTree_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if(e.Button != MouseButtons.Right)
				return;

			ContextMenu contextMenu = new ContextMenu();
			MenuItem menuItem = null;

			menuItem = new MenuItem("权限(&R)");
			menuItem.Click += new System.EventHandler(this.menu_editRights_Click);
			contextMenu.MenuItems.Add(menuItem);

			menuItem = new MenuItem("删除(&D)");
			menuItem.Click += new System.EventHandler(this.menu_deleteNode_Click);
            if (this.SelectedNode != null && this.SelectedNode.ImageIndex == ResTree.RESTYPE_SERVER)
                menuItem.Enabled = false;
			contextMenu.MenuItems.Add(menuItem);

            if (OnSetMenu != null)
            {
                GuiAppendMenuEventArgs newargs = new GuiAppendMenuEventArgs();
                newargs.ContextMenu = contextMenu;
                OnSetMenu(this, newargs);
                if (newargs.ContextMenu != contextMenu)
                    contextMenu = newargs.ContextMenu;
            }

            if (contextMenu != null)
                contextMenu.Show(this, new Point(e.X, e.Y));

		}
示例#4
0
        private void DatabaseObjectTree_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
                return;

            int nImageIndex = -1;
            if (this.SelectedNode != null)
                nImageIndex = this.SelectedNode.ImageIndex;

            ContextMenu contextMenu = new ContextMenu();
            MenuItem menuItem = null;


            menuItem = new MenuItem("编辑配置文件(&E)");
            menuItem.Click += new System.EventHandler(this.menu_editCfgFile);
            if (nImageIndex != ResTree.RESTYPE_FILE)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);


            menuItem = new MenuItem("新对象 [同级](&S)");
            menuItem.Click += new System.EventHandler(this.menu_newObjectSibling_Click);
            if (nImageIndex == ResTree.RESTYPE_DB || this.Nodes.Count == 0)
                menuItem.Enabled = false;
            else
                menuItem.Enabled = true;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("新对象 [下级](&H)");
            menuItem.Click += new System.EventHandler(this.menu_newObjectChild_Click);
            if (nImageIndex == ResTree.RESTYPE_FOLDER || nImageIndex == ResTree.RESTYPE_DB)
                menuItem.Enabled = true;
            else
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            bool bHasClipboardObject = false;
            IDataObject iData = Clipboard.GetDataObject();
            if (iData == null
                || iData.GetDataPresent(typeof(DatabaseObject)) == false)
                bHasClipboardObject = false;
            else
                bHasClipboardObject = true;


            menuItem = new MenuItem("复制树(&T)");
            menuItem.Click += new System.EventHandler(this.menu_copyTreeToClipboard_Click);
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("粘贴树(&A)");
            menuItem.Click += new System.EventHandler(this.menu_pasteTreeFromClipboard_Click);
            if (bHasClipboardObject == false)
            {
                menuItem.Enabled = false;
            }
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("复制(&C)");
            menuItem.Click += new System.EventHandler(this.menu_copyObjectToClipboard_Click);
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("粘贴[前插](&P)");
            menuItem.Click += new System.EventHandler(this.menu_pasteObjectFromClipboard_InsertBefore_Click);
            if (bHasClipboardObject == false)
            {
                menuItem.Enabled = false;
            }
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("粘贴[追加到下级末尾](&S)");
            menuItem.Click += new System.EventHandler(this.menu_pasteObjectFromClipboard_AppendChild_Click);
            if (bHasClipboardObject == false)
            {
                menuItem.Enabled = false;
            }
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);


            menuItem = new MenuItem("删除对象(&D)");
            menuItem.Click += new System.EventHandler(this.menu_deleteObject_Click);
            if (this.SelectedNode == null || nImageIndex == ResTree.RESTYPE_DB)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("模式(&M)");
            menuItem.Click += new System.EventHandler(this.menu_displayMode_Click);
            contextMenu.MenuItems.Add(menuItem);

            ////

            if (OnSetMenu != null)
            {
                GuiAppendMenuEventArgs newargs = new GuiAppendMenuEventArgs();
                newargs.ContextMenu = contextMenu;
                OnSetMenu(this, newargs);
                if (newargs.ContextMenu != contextMenu)
                    contextMenu = newargs.ContextMenu;
            }


            if (contextMenu != null)
                contextMenu.Show(this, new Point(e.X, e.Y));

        }
示例#5
0
        private void treeView_resRightTree_OnSetMenu(object sender, GuiAppendMenuEventArgs e)
        {
            Debug.Assert(e.ContextMenu != null, "e不能为null");

            MenuItem menuItem = new MenuItem("-");
            e.ContextMenu.MenuItems.Add(menuItem);

            TreeNode node = this.treeView_resRightTree.SelectedNode;
            string strText = "快速设置权限(&R)";

            if (node == null || node.ImageIndex == ResTree.RESTYPE_DB)
                strText = "快速设置权限[数据库整体](&R)";
            else
                strText = "快速设置权限[对象'" + node.Text + "'](&R)";

            menuItem = new MenuItem(strText);
            menuItem.Click += new System.EventHandler(this.menu_quickSetRights_Click);

            e.ContextMenu.MenuItems.Add(menuItem);
        }
示例#6
0
        private void treeView_res_OnSetMenu(object sender, DigitalPlatform.GUI.GuiAppendMenuEventArgs e)
        {
            Debug.Assert(e.ContextMenu != null, "e不能为null");

            int      nNodeType = -1;
            TreeNode node      = this.treeView_res.SelectedNode;

            if (node != null)
            {
                nNodeType = node.ImageIndex;
            }



            MenuItem menuItem = new MenuItem("-");

            e.ContextMenu.MenuItems.Add(menuItem);


            // 帐户管理
            menuItem        = new MenuItem("帐户(&A)...");
            menuItem.Click += new System.EventHandler(this.menuItem_accountManagement_Click);
            e.ContextMenu.MenuItems.Add(menuItem);

            // 新建帐户
            menuItem        = new MenuItem("新帐户(&N)...");
            menuItem.Click += new System.EventHandler(this.menuItem_newAccount_Click);
            e.ContextMenu.MenuItems.Add(menuItem);


            menuItem = new MenuItem("-");
            e.ContextMenu.MenuItems.Add(menuItem);


            // 配置数据库
            menuItem        = new MenuItem("数据库(&M)...");
            menuItem.Click += new System.EventHandler(this.menuItem_databaseManagement_Click);
            if (nNodeType != ResTree.RESTYPE_DB)
            {
                menuItem.Enabled = false;
            }
            e.ContextMenu.MenuItems.Add(menuItem);



            // 新建数据库
            menuItem        = new MenuItem("新建数据库(&N)...");
            menuItem.Click += new System.EventHandler(this.menuItem_newDatabase_Click);
            e.ContextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("-");
            e.ContextMenu.MenuItems.Add(menuItem);

            // 删除数据库
            menuItem        = new MenuItem("删除数据库(&D)");
            menuItem.Click += new System.EventHandler(this.menuItem_deleteObject_Click);
            if (nNodeType != ResTree.RESTYPE_DB &&
                nNodeType != ResTree.RESTYPE_FILE &&
                nNodeType != ResTree.RESTYPE_FOLDER)
            {
                menuItem.Enabled = false;
            }
            if (nNodeType != ResTree.RESTYPE_DB)
            {
                menuItem.Text = "删除对象(&D)";
            }
            e.ContextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("-");
            e.ContextMenu.MenuItems.Add(menuItem);

#if NO
            // 关联本地目录
            menuItem        = new MenuItem("关联本地目录(&L)...");
            menuItem.Click += new System.EventHandler(this.menuItem_linkLocalDir_Click);
            e.ContextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("-");
            e.ContextMenu.MenuItems.Add(menuItem);
#endif

            // 输出模板
            menuItem        = new MenuItem("导出模板(&E)...");
            menuItem.Click += new System.EventHandler(this.menuItem_exportTemplate_Click);
            e.ContextMenu.MenuItems.Add(menuItem);

            // 导入模板
            menuItem        = new MenuItem("导入模板(&I)...");
            menuItem.Click += new System.EventHandler(this.menuItem_importTemplate_Click);
            e.ContextMenu.MenuItems.Add(menuItem);
        }
示例#7
0
文件: ResTree.cs 项目: paopaofeng/dp2
		private void ResTree_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
                return;

            ContextMenu contextMenu = new ContextMenu();
            MenuItem menuItem = null;

            // TreeNode node = this.SelectedNode;

            //
            menuItem = new MenuItem("新增服务器(&A)");
            menuItem.Click += new System.EventHandler(this.menu_newServer);
            //	menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);


            // 
            menuItem = new MenuItem("登录(&L)");
            menuItem.Click += new System.EventHandler(this.menu_login);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("登出(&O)");
            menuItem.Click += new System.EventHandler(this.menu_logout);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("刷新(&R)");
            menuItem.Click += new System.EventHandler(this.menu_refresh);
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("初始化数据库(&I)");
            menuItem.Click += new System.EventHandler(this.menu_initialDB);
            if (this.SelectedNode == null || this.SelectedNode.ImageIndex != RESTYPE_DB)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("刷新数据库定义(&R)");
            menuItem.Click += new System.EventHandler(this.menu_refreshDB);
            if (this.SelectedNode == null || this.SelectedNode.ImageIndex != RESTYPE_DB)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("编辑配置文件(&E)");
            menuItem.Click += new System.EventHandler(this.menu_editCfgFile);
            if (this.SelectedNode == null || this.SelectedNode.ImageIndex != RESTYPE_FILE)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);


            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("修改密码(&P)");
            menuItem.Click += new System.EventHandler(this.menu_changePassword);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);


            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("后台任务(&T)");
            menuItem.Click += new System.EventHandler(this.menu_batchTask);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("导出数据(&E)");
            menuItem.Click += new System.EventHandler(this.menu_export);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("导入数据(&I)");
            menuItem.Click += new System.EventHandler(this.menu_import);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("快速导入数据(&S)");
            menuItem.Click += new System.EventHandler(this.menu_quickImport);
            if (this.SelectedNode == null)
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);

            //
            menuItem = new MenuItem("管理操作");
            contextMenu.MenuItems.Add(menuItem);

            MenuItem subMenuItem = new MenuItem("delete keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_deleteKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);


            subMenuItem = new MenuItem("create keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_createKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("disable keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_disableKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("rebuild keys index");
            subMenuItem.Click += new System.EventHandler(this.menu_rebuildKeysIndex);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            subMenuItem = new MenuItem("flush pending keys");
            subMenuItem.Click += new System.EventHandler(this.menu_flushKeysCache);
            if (this.SelectedNode == null)
                subMenuItem.Enabled = false;
            menuItem.MenuItems.Add(subMenuItem);

            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            // 
            menuItem = new MenuItem("允许复选(&M)");
            menuItem.Click += new System.EventHandler(this.menu_toggleCheckBoxes);
            if (this.CheckBoxes == true)
                menuItem.Checked = true;
            else
                menuItem.Checked = false;
            contextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("清除全部复选(&C)");
            menuItem.Click += new System.EventHandler(this.menu_clearCheckBoxes);
            if (this.CheckBoxes == true)
                menuItem.Enabled = true;
            else
                menuItem.Enabled = false;
            contextMenu.MenuItems.Add(menuItem);


            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            // 
            menuItem = new MenuItem("节点信息(&N)");
            menuItem.Click += new System.EventHandler(this.menu_nodeInfo);
            contextMenu.MenuItems.Add(menuItem);


            // ---
            menuItem = new MenuItem("-");
            contextMenu.MenuItems.Add(menuItem);

            // 
            menuItem = new MenuItem("在下级创建新目录或文件(&N)");
            menuItem.Click += new System.EventHandler(this.menu_newDirectoryOrFile);
            if (this.SelectedNode != null
                && (this.SelectedNode.ImageIndex == ResTree.RESTYPE_SERVER
                || this.SelectedNode.ImageIndex == ResTree.RESTYPE_DB
                || this.SelectedNode.ImageIndex == ResTree.RESTYPE_FOLDER))
                menuItem.Enabled = true;
            else
                menuItem.Enabled = false;

            contextMenu.MenuItems.Add(menuItem);

            // 测试
            {
                menuItem = new MenuItem("测试超时");
                menuItem.Click += menuItem_testTimeout_Click;
                contextMenu.MenuItems.Add(menuItem);
            }


            ////



            ////

            if (OnSetMenu != null)
            {
                GuiAppendMenuEventArgs newargs = new GuiAppendMenuEventArgs();
                newargs.ContextMenu = contextMenu;
                OnSetMenu(this, newargs);
                if (newargs.ContextMenu != contextMenu)
                    contextMenu = newargs.ContextMenu;
            }

            if (contextMenu != null)
                contextMenu.Show(this, new Point(e.X, e.Y));
        }