Example #1
0
        /// <summary>
        /// 彈出提示框
        /// </summary>
        /// <param name="message"></param>
        public void Alter(string message)
        {
            BeginInvoke(new CallBackDelegate(() =>
            {
                try
                {
                    AlertForm _alterForm = new AlertForm();
                    _alterForm.WindowState = FormWindowState.Normal;
                    _alterForm.StartPosition = FormStartPosition.CenterScreen;
                    _alterForm.Message = message;

                    _alterForm.ShowDialog(this);
                    _alterForm.TopLevel = true;
                    _alterForm.BringToFront();
                }
                catch (Exception ex)
                {
                    mLogger.Error(this._ControlCenter.MachineNo + "--" + ex.Message);
                }
            }));
        }
Example #2
0
 private void Help_Click(object sender, EventArgs e)
 {
     try
     {
         string helpfile = Application.StartupPath + Path.DirectorySeparatorChar + "DOC" + Path.DirectorySeparatorChar + "help.pdf";
         FileInfo file = new FileInfo(helpfile);
         if (file.Exists)
         {
             Common.Util.CmdUtil.RunCommand("start " + helpfile);
         }
         else
         {
             AlertForm alert = new AlertForm();
             alert.Name = "系統提示";
             alert.Message = "幫助文件不存在,請聯繫管理員。";
             alert.MessageBoxButtons = MessageBoxButtons.OK;
             alert.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         Common.General.PPCLogger.Error(this._ControlCenter.MachineNo + "--" + ex.Message);
     }
 }
Example #3
0
        /// <summary>
        /// 顯示警告信息
        /// </summary>
        /// <param name="text"></param>
        public void ShowWarningMessage(string text)
        {
            Logger.Warn(text);

            AlertForm alert = new AlertForm();
            alert.Name = this.SystemMessageText.strMessageTitle + this.SystemMessageText.strWarning.Trim();
            alert.Message = text;
            alert.MessageBoxButtons = MessageBoxButtons.OK;
            alert.ShowDialog(this);
        }
Example #4
0
        /// <summary>
        /// 顯示確認信息
        /// </summary>
        /// <param name="text"></param>
        public bool ShowQuestionMessage(string text)
        {
            AlertForm alert = new AlertForm();
            alert.Name = this.SystemMessageText.strMessageTitle + this.SystemMessageText.strQuestion.Trim();
            alert.Message = text;
            alert.MessageBoxButtons = MessageBoxButtons.YesNo;
            DialogResult result = alert.ShowDialog();

            bool isYes = false;
            if (result == DialogResult.Yes)
            {
                isYes = true;
            }

            return isYes;
        }
Example #5
0
        /// <summary>
        /// 顯示提示信息
        /// </summary>
        /// <param name="text"></param>
        public void ShowInformationMessage(string text)
        {
            Logger.Info(text);

            AlertForm alert = new AlertForm();
            alert.Name = this.SystemMessageText.strMessageTitle + this.SystemMessageText.strInformation.Trim();
            alert.Message = text;
            alert.MessageBoxButtons = MessageBoxButtons.OK;
            alert.ShowDialog(this);
        }
Example #6
0
        /// <summary>
        ///  顯示出錯信息
        /// </summary>
        /// <param name="text"></param>
        /// <param name="ex"></param>
        public void ShowErrorMessage(string text, Exception ex)
        {
            Logger.Error(ex);

            AlertForm alert = new AlertForm();
            alert.Name = this.SystemMessageText.strMessageTitle + this.SystemMessageText.strSystemError.Trim();
            alert.Message = text.Trim() + ":\r\n" + ex.Message;
            alert.MessageBoxButtons = MessageBoxButtons.OK;
            alert.ShowDialog(this);
        }
Example #7
0
        /// <summary>
        /// 顯示出錯信息
        /// </summary>
        /// <param name="Ex"></param>
        public void ShowErrorMessage(Exception Ex)
        {
            Logger.Error(Ex);

            AlertForm alert = new AlertForm();
            alert.Name = this.SystemMessageText.strMessageTitle + this.SystemMessageText.strInformation.Trim();
            alert.Message = "程序出現運行錯誤,請重試。/r/n錯誤原因:/r/n" + Ex.Message.Trim();
            alert.MessageBoxButtons = MessageBoxButtons.OK;
            alert.ShowDialog(this);
        }