Example #1
0
        /// <summary>
        /// 判断是否退出
        /// </summary>
        private void FrmRibbonMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (EmpInfo.Id <= 0)
            {
                e.Cancel = false;
                return;
            }

            var mdiFrm = this.MdiChildren;

            foreach (var frm in mdiFrm)
            {
                if (frm.DialogResult == DialogResult.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            DialogResult result = MessageHelper.ShowYesNoAndWarning("是否退出当前系统?");

            if (result == DialogResult.Yes)
            {
                LogHelper.Info(this, "退出系统 --- 关闭外部信息接口");
                infoRemoteAction.Close();

                LogHelper.Info(this, "退出系统 --- 关闭内部信息接口");
                infoLocalAction.Close();

                RemoteInfoHelper.Close();   //关闭消息服务连接

                EmpInfo.Logout();
                timer1.Stop();
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
Example #2
0
        /// <summary>
        ///  辅助处理
        /// </summary>
        private void bbi_ItemClick(object sender, ItemClickEventArgs e)
        {
            string item = e.Item.Tag.ToString();

            switch (item)
            {
            case "ABOUT":
                FrmAbout aboutform = new FrmAbout();
                aboutform.WindowState = FormWindowState.Normal;
                aboutform.ShowDialog();
                break;

            case "HELP":
                string file = EnvInfo.RunPath + "Help\\index.html";
                try
                {
                    Help.ShowHelp(this, file);
                }
                catch
                {
                    MessageHelper.ShowError("打开帮助文件不成功。");
                }
                break;

            case "CALC":                       //  计算器
                Process pRunExeFile = new Process();
                pRunExeFile.StartInfo.FileName = System.Environment.SystemDirectory + "\\calc.exe";
                pRunExeFile.Start();
                break;

            case "DFM":
                FrmMenuDefault frmdfm = new FrmMenuDefault();
                frmdfm.ShowDialog();
                break;

            case "SQLM":
                FrmSQLMonitorWithMsg frmsm = new FrmSQLMonitorWithMsg();
                frmsm.MdiParent = this;
                frmsm.Init();
                frmsm.Show();
                break;

            case "PASSWORD":
                FrmPassword frmpw = new FrmPassword();
                frmpw.ShowDialog();
                break;

            case "EXIT":
                this.Close();
                break;

            case "CLOSECHILD":
                foreach (FrmBase frmmdi in this.MdiChildren)
                {
                    frmmdi.Close();
                }
                break;

            case "RELOGIN":
                if (this.MdiChildren.GetLength(0) > 0)
                {
                    MessageHelper.ShowWarning("还有未关闭窗口,请关闭后再转换!");
                    return;
                }

                LogHelper.Info(this, "退出系统 --- 停止定时器");
                this.timer1.Stop();

                LogHelper.Info(this, "退出系统 --- 关闭外部信息接口");
                infoRemoteAction.Close();

                LogHelper.Info(this, "退出系统 --- 关闭内部信息接口");
                infoLocalAction.Close();

                EmpInfo.Logout();
                LogHelper.Info(this, "退出系统完成");

                //  打开登录窗口, 成功后刷新界面
                FrmLogin frm_login = new FrmLogin();
                frm_login.Text = this.Title;
                if (frm_login.ShowDialog() == DialogResult.OK)
                {
                    this.Init();
                }
                else
                {
                    this.Close();
                }
                break;

            case "LOG0":
                LogHelper._logLevel      = 0;
                this.bciLogNone.Checked  = true;
                this.bciLogError.Checked = false;
                this.bciLogWarn.Checked  = false;
                this.bciLogDebug.Checked = false;
                this.bciLogInfo.Checked  = false;
                break;

            case "LOG1":
                LogHelper._logLevel      = 1;
                this.bciLogNone.Checked  = false;
                this.bciLogError.Checked = true;
                this.bciLogWarn.Checked  = false;
                this.bciLogDebug.Checked = false;
                this.bciLogInfo.Checked  = false;
                break;

            case "LOG2":
                LogHelper._logLevel      = 2;
                this.bciLogNone.Checked  = false;
                this.bciLogError.Checked = false;
                this.bciLogWarn.Checked  = true;
                this.bciLogDebug.Checked = false;
                this.bciLogInfo.Checked  = false;
                break;

            case "LOG3":
                LogHelper._logLevel      = 3;
                this.bciLogNone.Checked  = false;
                this.bciLogError.Checked = false;
                this.bciLogWarn.Checked  = false;
                this.bciLogDebug.Checked = true;
                this.bciLogInfo.Checked  = false;
                break;

            case "LOG4":
                LogHelper._logLevel      = 4;
                this.bciLogNone.Checked  = false;
                this.bciLogError.Checked = false;
                this.bciLogWarn.Checked  = false;
                this.bciLogDebug.Checked = false;
                this.bciLogInfo.Checked  = true;
                break;
            }
        }