Esempio n. 1
0
        ToolStripMenuItem menuItemExitB = null;              // 退出菜单

        /// <summary>
        /// 创建管理菜单
        /// </summary>
        private void BuildManageMenuB()
        {
            // 密码修改菜单
            menuItemPwdChangeB = new ToolStripMenuItem("密码修改(&P");
            menuItemPwdChangeB.Click += delegate
            {
                FrmChangePwd frmPwdChange = new FrmChangePwd(frmMain, "Login.xml");
                frmPwdChange.ShowDialog();
                frmPwdChange.Dispose();
            };
            menuItemManageB.DropDownItems.Add(menuItemPwdChangeB);

            // 用户登录菜单
            menuItemLoginB = new ToolStripMenuItem("登录(&L)");             // 登录菜单
            menuItemLoginB.Click += delegate
            {
                if (menuItemLoginB.Text == "注销(&L)")
                {
                    MainHelper.MenuPowerChange(EnumPowers.Default);
                }
                else
                {
                    FrmLogin frmLogin = new FrmLogin(frmMain, "Login.xml");
                    frmLogin.ErrorMessage += frmLogin_ErrorMessage;
                    frmLogin.ShowDialog();
                    frmLogin.Dispose();
                }
            };
            menuItemManageB.DropDownItems.Add(menuItemLoginB);

            // 分隔符
            menuItemSeparator1B = new ToolStripSeparator();               // 分隔符 1
            menuItemManageB.DropDownItems.Add(menuItemSeparator1B);

            //// 插件管理菜单
            //menuItemPluginB = new ToolStripMenuItem("插件管理(&M)");        // 插件菜单
            //menuItemManageB.DropDownItems.Add(menuItemPluginB);

            //// 分隔符
            //menuItemSeparator2B = new ToolStripSeparator();                // 分隔符 2
            //menuItemManageB.DropDownItems.Add(menuItemSeparator2B);

            // 退出菜单
            menuItemExitB = new ToolStripMenuItem("退出(&X)");              // 退出菜单
            menuItemExitB.Click += delegate {
                if (MessageBox.Show("关闭通讯程序会对数据造成一定影响,确定要关闭通讯程序吗?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    CzltSaveChkXml2(true);
                    frmMain.Exit();
                }
            };
            menuItemManageB.DropDownItems.Add(menuItemExitB);
        }
Esempio n. 2
0
        ToolStripMenuItem menuItemExitA = null;              // 退出菜单

        /// <summary>
        /// 创建管理菜单
        /// </summary>
        private void BuildManageMenuA()
        {
            // 密码修改菜单
            menuItemPwdChangeA = new ToolStripMenuItem("密码修改(&P");
            menuItemPwdChangeA.Click += delegate
            {
                FrmChangePwd frmPwdChange = new FrmChangePwd(frmMain, "Login.xml");
                frmPwdChange.ErrorMessage += frmPwdChange_ErrorMessage;
                frmPwdChange.ShowDialog();
                frmPwdChange.Dispose();
            };
            menuItemManageA.DropDownItems.Add(menuItemPwdChangeA);

            // 用户登录菜单
            menuItemLoginA = new ToolStripMenuItem("登录(&L)");             // 登录菜单
            menuItemLoginA.Click += delegate
            {
                if (menuItemLoginA.Text == "注销(&L)")
                {
                    //Czlt-2010-09-25
                    DialogResult result;
                    result = MessageBox.Show("是否要注销系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        MainHelper.MenuPowerChange(EnumPowers.Default);
                    }
                    //MainHelper.MenuPowerChange(EnumPowers.Default);
                }
                else
                {
                    FrmLogin frmLogin = new FrmLogin(frmMain, "Login.xml");
                    frmLogin.ErrorMessage += frmLogin_ErrorMessage;
                    frmLogin.ShowDialog();
                    frmLogin.Dispose();
                }
            };
            menuItemManageA.DropDownItems.Add(menuItemLoginA);


            // 分隔符
            menuItemSeparator1A = new ToolStripSeparator();                // 分隔符 1
            menuItemManageA.DropDownItems.Add(menuItemSeparator1A);

            //// 插件管理菜单
            //menuItemPluginA = new ToolStripMenuItem("插件管理(&M)");        // 插件菜单
            //menuItemManageA.DropDownItems.Add(menuItemPluginA);

            //// 分隔符
            //menuItemSeparator2A = new ToolStripSeparator();                // 分隔符 2
            //menuItemManageA.DropDownItems.Add(menuItemSeparator2A);

            // 退出菜单
            menuItemExitA = new ToolStripMenuItem("退出(&X)");              // 退出菜单
            menuItemExitA.Click += delegate
            {
                //Czlt-2010-09-25
                DialogResult result;
                result = MessageBox.Show("是否要退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    frmMain.Exit();
                }
                //   frmMain.Exit(); 
            };
            menuItemManageA.DropDownItems.Add(menuItemExitA);
        }