Пример #1
0
        /// <summary>
        /// 线程异常
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            try
            {
                Apq.Exception A_ex = new Apq.Exception(e.Exception);
                Apq.GlobalObject.ApqLog.Error("线程异常", A_ex.OriginalException);

                DelayConfirmBox dcb;
                switch (A_ex.Level)
                {
                case 1:                         // 提示 + 可选
                    dcb          = new DelayConfirmBox(10, A_ex.OriginalException.Message + "\n\n是否继续运行?");
                    dcb.Text     = "错误";
                    dcb.NoClick += new EventHandler(dcb_NoClick);
                    dcb.Show();
                    break;

                case 2:                         // 提示 + 退出
                    dcb              = new DelayConfirmBox(10, A_ex.OriginalException.Message + "\n\n请重新运行程序.\n如果经常看到此对话框,请联系管理员");
                    dcb.Text         = "灾难性错误";
                    dcb.YesClick    += new EventHandler(dcb_NoClick);
                    dcb.NoClick     += new EventHandler(dcb_NoClick);
                    dcb.CancelClick += new EventHandler(dcb_NoClick);
                    dcb.ShowDialog();
                    break;
                }
            }
            catch
            {
            }
        }
Пример #2
0
		/// <summary>
		/// 线程异常
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
		{
			try
			{
				Apq.Exception A_ex = new Apq.Exception(e.Exception);
				Apq.GlobalObject.ApqLog.Error("线程异常", A_ex.OriginalException);

				DelayConfirmBox dcb;
				switch (A_ex.Level)
				{
					case 1:	// 提示 + 可选
						dcb = new DelayConfirmBox(10, A_ex.OriginalException.Message + "\n\n是否继续运行?");
						dcb.Text = "错误";
						dcb.NoClick += new EventHandler(dcb_NoClick);
						dcb.Show();
						break;
					case 2:	// 提示 + 退出
						dcb = new DelayConfirmBox(10, A_ex.OriginalException.Message + "\n\n请重新运行程序.\n如果经常看到此对话框,请联系管理员");
						dcb.Text = "灾难性错误";
						dcb.YesClick += new EventHandler(dcb_NoClick);
						dcb.NoClick += new EventHandler(dcb_NoClick);
						dcb.CancelClick += new EventHandler(dcb_NoClick);
						dcb.ShowDialog();
						break;
				}
			}
			catch
			{
			}
		}