当前位置: 首页>>代码示例>>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;未经允许,请勿转载。