• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Threading.ThreadExceptionEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Threading.ThreadExceptionEventArgs的典型用法代码示例。如果您正苦于以下问题:C# ThreadExceptionEventArgs类的具体用法?C# ThreadExceptionEventArgs怎么用?C# ThreadExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ThreadExceptionEventArgs类属于System.Threading命名空间,在下文中一共展示了ThreadExceptionEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: MainWnd_UIThreadException

        // Handle the UI exceptions by showing a dialog box, and asking the user whether 
        // or not they wish to abort execution. 
        private static void MainWnd_UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            DialogResult result = DialogResult.Cancel;
            try
            {
                Event clsEvent = new Event();
                clsEvent.AddErrorEventLn(t.Exception);

                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:marioricci,项目名称:erp-luma,代码行数:28,代码来源:Program.cs


示例17: ThreadExceptionHandler

        ///// <summary>
        ///// Used for handling System.Threading.Tasks bound to a background worker thread.
        ///// Handles the <see cref="UnobservedTaskException"/> event in <see cref="System.Threading.Tasks"/> namespace.
        ///// </summary>
        //public static EventHandler<UnobservedTaskExceptionEventArgs> UnobservedTaskException
        //{
        //    get
        //    {
        //    }
        //}

        /// <summary>
        /// Used for handling WinForms exceptions bound to the UI thread.
        /// Handles the <see cref="Application.ThreadException"/> events in <see cref="System.Windows.Forms"/> namespace.
        /// </summary>
        /// <param name="sender">Exception sender object.</param>
        /// <param name="e">Real exception is in: e.Exception</param>
        private static void ThreadExceptionHandler(object sender, ThreadExceptionEventArgs e)
        {
            //regular exception handling logic...


            InitializeReport(e.Exception, Assembly.GetCallingAssembly());
        }
开发者ID:FMSC-Measurements,项目名称:FMSC.Util,代码行数:24,代码来源:ErrorHandlers.FFOnly.cs


示例18: ApplicationOnThreadException

 private static void ApplicationOnThreadException(object sender, ThreadExceptionEventArgs e)
 {
     MessageBox.Show(e.Exception.Message,
                     Application.ProductName,
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Error);
 }
开发者ID:Solnake,项目名称:kayflow,代码行数:7,代码来源:Program.cs


示例19: Application_ThreadException

 public static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     LibSys.StatusBar.Error("Application ThreadException " + (e == null ? "" : ("" + e.Exception)));
     #if DEBUG
     Project.ErrorBox(null, "Application ThreadException " + (e == null ? "" : ("" + e.Exception)));
     #endif
 }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:7,代码来源:QuakeMap.cs


示例20: UiThreadException

        /// <summary>
        /// UIs the thread exception.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="t">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
        private static void UiThreadException(object sender, ThreadExceptionEventArgs t)
        {
            try
            {
                MessageBox.Show(Resources.Program_UiThreadException);
            }
            catch
            {
                try
                {
                    MessageBox.Show(
                        Resources.Program_UiThreadException_Fatal_exception_happend_inside_UIThreadException_handler,
                        Resources.Program_UiThreadException_Fatal_Windows_Forms_Error,
                        MessageBoxButtons.AbortRetryIgnore,
                        MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }

            // Here we can decide if we want to end our application or do something else
            Application.Exit();
        }
开发者ID:prachwal,项目名称:MDIwithMVP,代码行数:30,代码来源:AbstractProgram.cs



注:本文中的System.Threading.ThreadExceptionEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Threading.Timer类代码示例发布时间:2022-05-26
下一篇:
C# Threading.Thread类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap