コード例 #1
0
        /// <summary>
        /// //显示程序运行中产生的异常消息并计入日志
        /// </summary>
        /// <param name="msg">消息</param>
        protected void SetExceptionMSG(Exception msg)
        {
            ShowExceptionMSgDelegate showmsgDelegate = new ShowExceptionMSgDelegate(SetExceptionmsgDelegateTargetFun);

            if (txtBoxMSG.InvokeRequired)
            {
                txtBoxMSG.BeginInvoke(showmsgDelegate, msg);
            }
            else
            {
                if (txtBoxMSG.Text.Length > 1024 * 512)
                {
                    txtBoxMSG.Text = string.Empty;
                }
                txtBoxMSG.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + msg.ToString() + "\r\n");
            }
            muExceptionLog.WaitOne();
            //SiXi.Logs.Log.WriteDebugLog(msg.ToString());
            muExceptionLog.ReleaseMutex();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: qiazi/TXRF_SAXRD
 /// <summary>
 /// //显示程序运行中产生的异常消息并计入日志
 /// </summary>
 /// <param name="msg">消息</param>
 protected void SetExceptionMSG(Exception msg)
 {
     ShowExceptionMSgDelegate showmsgDelegate = new ShowExceptionMSgDelegate(SetExceptionmsgDelegateTargetFun);
     if (txtBoxMSG.InvokeRequired)
     {
         txtBoxMSG.BeginInvoke(showmsgDelegate, msg);
     }
     else
     {
         if (txtBoxMSG.Text.Length > 1024 * 512)
         {
             txtBoxMSG.Text = string.Empty;
         }
         txtBoxMSG.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + msg.ToString() + "\r\n");
     }
     muExceptionLog.WaitOne();
     SiXi.Logs.Log.WriteDebugLog(msg.ToString());
     muExceptionLog.ReleaseMutex();
 }