當前位置: 首頁>>代碼示例>>C#>>正文


C# Threading.ThreadExceptionEventArgs類代碼示例

本文整理匯總了C#中System.Threading.ThreadExceptionEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# ThreadExceptionEventArgs類的具體用法?C# ThreadExceptionEventArgs怎麽用?C# ThreadExceptionEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ThreadExceptionEventArgs類屬於System.Threading命名空間,在下文中一共展示了ThreadExceptionEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Application_ThreadException

 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     string str = GetExceptionMsg(e.Exception, e.ToString());
     Loger.Error(str);
     //MessageBox.Show(str, "係統錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
     //LogManager.WriteLog(str);
 }
開發者ID:safawo,項目名稱:Dev.ProcessMonitor,代碼行數:7,代碼來源:Program.cs

示例2: Application_ThreadException

 static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     var message =
         e.Exception.Message + Environment.NewLine + e.Exception.Source + Environment.NewLine + e.Exception.StackTrace
         + Environment.NewLine + e.Exception.InnerException;
     new Error().Add(message);
 }
開發者ID:Alchemy86,項目名稱:GD_BackOrders,代碼行數:7,代碼來源:Program.cs

示例3: Application_ThreadException

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            //MessageBox.Show(e.Exception.Message, "Unhandled Thread Exception");
            // here you can log the exception ...
            logger.Log(LogLevel.Debug, e.Exception.Message);

        }
開發者ID:BruceNielsen,項目名稱:_V4.7-Proxy,代碼行數:7,代碼來源:Program.cs

示例4: Application_ThreadException

        // Handle the UI exceptions by showing a dialog box, and asking the user whether
        // or not they wish to abort execution.
        private static void Application_ThreadException(object sender, ThreadExceptionEventArgs t)
        {
            try
            {
                reportError(t.Exception);
            }
            catch (Exception) { }
            DialogResult result = DialogResult.Cancel;
            try
            {
                result = ShowThreadExceptionDialog("Windows Forms Error", t.Exception);
            }
            catch
            {
                try
                {
                    MessageBox.Show("Fatal Windows Forms Error",
                        "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }

            // Exits the program when the user clicks Abort.
            if (result == DialogResult.Abort)
                Application.Exit();
        }
開發者ID:NinjaOctocow,項目名稱:MCLauncher.NET,代碼行數:31,代碼來源:Program.cs

示例5: Application_ThreadException

 // Handle the UI exceptions by showing a dialog box, and asking the user whether or not they wish to abort execution.
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     var exc = e.Exception;
     // Ignore CultureNotFoundException to avoid error when changing language (on some computers) - see https://github.com/SubtitleEdit/subtitleedit/issues/719
     if (!(exc is System.Globalization.CultureNotFoundException))
     {
         var dr = DialogResult.Abort;
         try
         {
             var cap = "Windows Forms Thread Exception";
             var msg = "An application error occurred in Subtitle Edit." +
                       "\nPlease report at https://github.com/SubtitleEdit/subtitleedit/issues with the following information:" +
                       "\n\nError Message:\n" + exc.Message +
                       "\n\nStack Trace:\n" + exc.StackTrace;
             dr = MessageBox.Show(msg, cap, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
         }
         catch
         {
         }
         if (dr == DialogResult.Abort)
         {
             Application.Exit();
         }
     }
 }
開發者ID:LeonCheung,項目名稱:subtitleedit,代碼行數:26,代碼來源:Program.cs

示例6: catchUIThreadException

		static void catchUIThreadException(object sender, ThreadExceptionEventArgs args)
		{
		  Exception e =  args.Exception;
	      MessageBox.Show("An unhandled thread exception has occured." + Environment.NewLine
	                     +"Error Message: " + e.Message + Environment.NewLine
	                     +"Stacktrace: " + e.StackTrace,"Unexpected Exception",MessageBoxButtons.OK,MessageBoxIcon.Error);
		}
開發者ID:jzarca01,項目名稱:ZamiGen_addin,代碼行數:7,代碼來源:EAAddinBase.cs

示例7: OnThreadException

 private void OnThreadException(object sender, ThreadExceptionEventArgs e)
 {
     if (!this.CanIgnoreException(e.Exception))
     {
         DialogResult cancel = DialogResult.Cancel;
         try
         {
             cancel = this.ReportException(e.Exception);
         }
         catch
         {
             try
             {
                 this.ReportFatalException(e.Exception);
             }
             finally
             {
                 cancel = DialogResult.Abort;
             }
         }
         if (cancel == DialogResult.Abort)
         {
             Application.Exit();
         }
     }
 }
開發者ID:ikvm,項目名稱:webmatrix,代碼行數:26,代碼來源:GlobalExceptionHandler.cs

示例8: ApplicationThreadException

 static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     if (e != null)
     {
         WriteError(e.Exception);
     }
 }
開發者ID:peschuster,項目名稱:propresenter-remote,代碼行數:7,代碼來源:Program.cs

示例9: HandleThreadException

			public static void HandleThreadException (object sender, ThreadExceptionEventArgs args)
			{
				_thisForm.Refresh ();
				Application.DoEvents ();
				HasHandledException = true;
				_thisForm.Close ();
			}
開發者ID:Profit0004,項目名稱:mono,代碼行數:7,代碼來源:ApplicationTest.cs

示例10: OnThreadException

            // Handles the exception event.
            public void OnThreadException(object sender, ThreadExceptionEventArgs t)
            {
                DialogResult result = System.Windows.Forms.DialogResult.Cancel;
                try
                {
                    result = this.ShowThreadExceptionDialog(t.Exception);
                }
                catch
                {
                    try
                    {
                        MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                    }
                    finally
                    {
                        Application.Exit();
                    }
                }

                // Exits the program when the user clicks Abort.
                if (result == System.Windows.Forms.DialogResult.Abort)
                {
                    //					if (frm.SaveModel(true))
                    //					{
                    Application.Exit();
                    //					}
                }
            }
開發者ID:BackupTheBerlios,項目名稱:puzzle-svn,代碼行數:29,代碼來源:AppEntry.cs

示例11: UIThreadException

		private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
		{
			DialogResult result = DialogResult.Cancel;
			try
			{
				Exception ex = (Exception)t.Exception;

				string errorMsg = "UIThreadException\r\n\r\n";
				errorMsg += "Oops, gInk crashed! Please include the following information if you plan to contact the developers (a copy of the following information is stored in crash.txt in the application folder):\r\n\r\n";
				errorMsg += ex.Message + "\r\n\r\n";
				errorMsg += "Stack Trace:\r\n" + ex.StackTrace + "\r\n\r\n";
				WriteErrorLog(errorMsg);

				errorMsg += "!!! PLEASE PRESS ESC KEY TO EXIT IF YOU FEEL YOUR MOUSE CLICK IS BLOCKED BY SOMETHING";
				ShowErrorDialog("UIThreadException", errorMsg);
			}
			catch
			{
				try
				{
					MessageBox.Show("Fatal Windows Forms Error", "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
				}
				finally
				{
					Application.Exit();
				}
			}

			// Exits the program when the user clicks Abort.
			if (result == DialogResult.Abort)
				Application.Exit();
		}
開發者ID:geovens,項目名稱:gInk,代碼行數:32,代碼來源:Program.cs

示例12: PrintError

 private static void PrintError(object sender, ThreadExceptionEventArgs args)
 {
     using (var writer = new StreamWriter("error.log", false))
     {
         writer.Write(args.Exception.ToString());
     }
 }
開發者ID:LaoArchAngel,項目名稱:WRadar,代碼行數:7,代碼來源:Program.cs

示例13: Application_ThreadException

 // Unhandled UI exceptions (can ignore and resume)
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs t)
 {
     DialogResult result = DialogResult.Abort;
     try
     {
         if (logUiExceptionsOnly)
         {
             Console.WriteLine("EXCEPTION: " + ((Exception)t.Exception).ToString() + "");
             result = DialogResult.Ignore;
         }
         else
         {
             Exception ex = (Exception)t.Exception;
             string error =
                 "Sorry, an application error occurred (unhandled UI exception).\r\n\r\n" +
                 "Exception: " + ex.ToString() + "\r\n\r\n" +
                 "Stack trace: " + ex.StackTrace + "";
             result = MessageBox.Show(error, Application.ProductName, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
         }
     }
     catch { ; }
     finally
     {
         if (result == DialogResult.Abort) { Application.Exit(); }
     }
 }
開發者ID:nhammerla,項目名稱:openmovement,代碼行數:27,代碼來源:Program.cs

示例14: Application_ThreadException

 void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     string err = e.Exception.Message + Environment.NewLine + e.Exception.StackTrace;
     if (e.Exception.InnerException != null)
         err += Environment.NewLine + e.Exception.InnerException.Message + Environment.NewLine + e.Exception.InnerException.StackTrace;
     txtRet.Text = err;
 }
開發者ID:tian1ll1,項目名稱:WPF_Examples,代碼行數:7,代碼來源:Form1.cs

示例15: UIThreadExceptionHandler

        /// <summary>
        /// Handle for untrapped thread exceptions.
        /// </summary>
        /// <param name="sender">
        /// Sender object.
        /// </param>
        /// <param name="t">
        /// Exception event arguments.
        /// </param>
        private static void UIThreadExceptionHandler(object sender, ThreadExceptionEventArgs t)
        {
            DialogResult result = DialogResult.Cancel;
            try
            {
                result = Program.ShowThreadExceptionDialog(t.Exception);
            }
            catch
            {
                try
                {
                    string text = "Fatal " + ErrorTitle;
                    MessageBox.Show(text, text, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }

            // Exits the program when the user clicks Abort.
            if (result == DialogResult.Abort)
            {
                Application.Exit();
            }
        }
開發者ID:AlloBardo,項目名稱:robot-mitya,代碼行數:35,代碼來源:Program.cs


注:本文中的System.Threading.ThreadExceptionEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。