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

C# Windows.ApplicationUnhandledExceptionEventArgs类代码示例

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

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



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

示例1: Application_UnhandledException

        private static void Application_UnhandledException(
            object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            var ex = e.ExceptionObject;

            AnalyticsTracker.Track(
                new TrackingEvent("error")
                {
                    {"type", ex.GetType().FullName},
                    {"stack", ex.StackTrace}
                });

            if (!Debugger.IsAttached)
            {
                e.Handled = true;

                var email = MessageBox.Show(
                    Properties.Resources.UnhandledExPrompt,
                    Properties.Resources.UnhandledExTitle,
                    MessageBoxButton.OKCancel) == MessageBoxResult.OK;

                if (email)
                {
                    ErrorReport.Report(ex);
                    return;
                }

                throw new QuitException();
            }

            Debugger.Break();
        }
开发者ID:nthobois,项目名称:7Pass,代码行数:32,代码来源:App.xaml.cs


示例2: OnAppUnhandledException

 private void OnAppUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (AppUnhandledException != null)
     {
         AppUnhandledException(e);
     }
 }
开发者ID:akalafrancis,项目名称:sipsorcery-mono,代码行数:7,代码来源:App.xaml.cs


示例3: Application_UnhandledException

 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (!Debugger.IsAttached) {
         e.Handled = true;
         Deployment.Current.Dispatcher.BeginInvoke(() => this.ReportErrorToDOM(e));
     }
 }
开发者ID:sealong,项目名称:practice,代码行数:7,代码来源:App.xaml.cs


示例4: Application_UnhandledException

        private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            try
            {
                string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
                errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

                Tracer.Error(errorMsg);
                e.Handled = true;

                var control = new ExceptionControl();
                var viewModel = new ExceptionViewModel();

                viewModel.Exception = GenerateCrashReport(e.ExceptionObject);
                control.DataContext = viewModel;

                _gameHost.LayoutRoot.Children.Clear();
                _gameHost.LayoutRoot.Children.Add(control);
            }
            catch
            {
                try
                {
                    MessageBox.Show(e.ExceptionObject.ToString());
                }
                catch
                {
                    ReportErrorToDOM(e.ExceptionObject);
                }
            }
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:31,代码来源:App.xaml.cs


示例5: Application_UnhandledException

 // Code to execute on Unhandled Exceptions
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached) {
         // An unhandled exception has occurred; break into the debugger
         System.Diagnostics.Debugger.Break();
     }
 }
开发者ID:KhalidElSayed,项目名称:congress-winphone,代码行数:8,代码来源:App.xaml.cs


示例6: Application_UnhandledException

        private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached) return;

            e.Handled = true;
            Deployment.Current.Dispatcher.BeginInvoke(() => ReportErrorToDOM(e));
        }
开发者ID:follesoe,项目名称:FrontEnd2010,代码行数:7,代码来源:App.xaml.cs


示例7: ReportErrorToDOM

        private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
        {
            try
               {
              //string errorMsg;
              //errorMsg = e.ExceptionObject.GetType().ToString();
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");
              //
              //errorMsg = e.ExceptionObject.Message;
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");
              //
              //
              //errorMsg = e.ExceptionObject.StackTrace ;
              //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
              //System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('" + errorMsg + "');");

              ////System.Windows.Browser.HtmlPage.Window.Eval("ttrace.debug().send('" + errorMsg + "');");

              System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('ReportErrorToDOM error');");
               }
               catch (Exception)
               {
              System.Windows.Browser.HtmlPage.Window.Eval("ttrace.display('ReportErrorToDOM error');");
               }
        }
开发者ID:Zekom,项目名称:tracetool,代码行数:27,代码来源:App.xaml.cs


示例8: Application_UnhandledException

        /// <summary>未処理例外発生イベントハンドラ</summary>
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            // アプリケーションがデバッガーの外側で実行されている場合、ブラウザーの
            // 例外メカニズムによって例外が報告されます。これにより、IE ではステータス バーに
            // 黄色の通知アイコンが表示され、Firefox にはスクリプト エラーが表示されます。
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                // メモ : これにより、アプリケーションは例外がスロー
                // された後も実行され続け、例外はハンドルされません。 
                // 実稼動アプリケーションでは、このエラー処理は、Web サイトにエラーを
                // 報告し、アプリケーションを停止させるものに置換される必要があります。
                e.Handled = true;

                // JavaScriptで例外レポートを報告
                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
            }

            // MessageBoxで例外情報表示
            MessageBox.Show(e.ExceptionObject.Message);

            // MessageBoxで内部例外情報表示
            if (e.ExceptionObject.InnerException != null)
            {
                MessageBox.Show(e.ExceptionObject.InnerException.Message);
            }
        }
开发者ID:krt,项目名称:OpenTouryo,代码行数:27,代码来源:App.xaml.cs


示例9: Application_UnhandledException

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            //MessageBox.Show(e.ExceptionObject.Message);
            try
            {
                if (RootVisual == null)
                {
                    string msg = e.ExceptionObject.Message;
                    if (e.ExceptionObject is CustomException)
                    {
                        CustomException csEx = (CustomException)e.ExceptionObject;
                        msg = csEx.ExceptionMessage;
                    }
                    System.Windows.MessageBox.Show(msg);
                    return;
                }
                else if (RootVisual.CheckAccess())  //是否能线程访问
                {
                    HandleAppException(e);
                }
                else
                {
                    RootVisual.Dispatcher.BeginInvoke(() =>
                    {
                        HandleAppException(e);
                    });
                }
            }
            catch (Exception)
            {

            }
            e.Handled = true;
            return;
        }
开发者ID:RandyCode,项目名称:SimpleTools,代码行数:35,代码来源:App.xaml.cs


示例10: Application_UnhandledException

 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (!System.Diagnostics.Debugger.IsAttached)
     {
     }
     e.Handled = true;
 }
开发者ID:nicholasceliano,项目名称:Silverlight,代码行数:7,代码来源:App.xaml.cs


示例11: Application_UnhandledException

		private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
		{
			// Allow the application to continue running after an exception has been thrown but not handled
			Exception ex = e.ExceptionObject;
			ex.Alert();
			e.Handled = true;
		}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:7,代码来源:App.xaml.cs


示例12: Application_UnhandledException

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            try
            {
                ILog logger = new Logger(new Framework.SL.Repositories.LogEntryWebserviceRepository());
                ErrorLogEntry error = new ErrorLogEntry()
                {
                    Message = e.ExceptionObject.ToString(),
                    Source = "UNHANDLED IN: " + sender.GetType().ToString(),
                    TimeStamp = DateTime.Now
                };

                logger.WriteEntry(error);
                e.Handled = true;
            }
            catch (Exception logException)
            {
                // If the app is running outside of the debugger then report the exception using
                // the browser's exception mechanism. On IE this will display it a yellow alert 
                // icon in the status bar and Firefox will display a script error.
                if (!System.Diagnostics.Debugger.IsAttached)
                {
                    // NOTE: This will allow the application to continue running after an exception has been thrown
                    // but not handled. 
                    // For production applications this error handling should be replaced with something that will 
                    // report the error to the website and stop the application.
                    e.Handled = true;
                    //MessageBox.Show(e.ExceptionObject.Message);
                    //Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
                }
            }
        }
开发者ID:ArildF,项目名称:Smeedee,代码行数:32,代码来源:App.xaml.cs


示例13: Application_UnhandledException

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
		{
			if (System.Diagnostics.Debugger.IsAttached) return;

			e.Handled = true;
			ErrorPresenter.Show(e.ExceptionObject);
		}
开发者ID:hibernating-rhinos,项目名称:RavenFS,代码行数:7,代码来源:App.xaml.cs


示例14: App_UnhandledException

 void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject.GetType() == typeof (NoInternetConnectionException))
         MessageBox.Show("Could not find an Internet connection - please try again later");
     else
         MessageBox.Show("An error occured - the application will now close");
 }
开发者ID:xximjasonxx,项目名称:Codemash,代码行数:7,代码来源:App.xaml.cs


示例15: App_UnhandledException

 private void App_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
 }
开发者ID:shaftware,项目名称:Torch,代码行数:7,代码来源:App.xaml.cs


示例16: Application_UnhandledException

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            // If the app is running outside of the debugger then report the exception using
            // the browser's exception mechanism. On IE this will display it a yellow alert
            // icon in the status bar and Firefox will display a script error.
            if (!System.Diagnostics.Debugger.IsAttached)
            {

                // NOTE: This will allow the application to continue running after an exception has been thrown
                // but not handled.
                // For production applications this error handling should be replaced with something that will
                // report the error to the website and stop the application.
                e.Handled = true;

                try
                {
                    string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
                    errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

                    System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");");
                }
                catch (Exception)
                {
                }
            }
        }
开发者ID:DaspawnW,项目名称:Denon-Receiver-Gadget,代码行数:26,代码来源:App.xaml.cs


示例17: Application_UnhandledException

 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
     //errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
     e.Handled = false;
     MessageBox.Show(errorMsg);
 }
开发者ID:DuBin1988,项目名称:newsellinggas,代码行数:7,代码来源:App.xaml.cs


示例18: Application_UnhandledException

 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached)
     {
         System.Diagnostics.Debugger.Break();
     }
 }
开发者ID:nikhildhawan,项目名称:c2dm,代码行数:7,代码来源:App.xaml.cs


示例19: OnUnhandledException

 protected override void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     MessageBox.Show("Unexpected problem occured. Application will be closed." +
                     (System.Diagnostics.Debugger.IsAttached ? '\n' + e.ExceptionObject.Message : ""),
                     "Unexpected problem", MessageBoxButton.OK);
     base.OnUnhandledException(sender, e);
 }
开发者ID:scuhurricane,项目名称:Sample-Projects,代码行数:7,代码来源:ClientsManagerBootStrapper.cs


示例20: Application_UnhandledException

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is DomainOperationException)
            {
                if (((DomainOperationException)e.ExceptionObject).Status == OperationErrorStatus.Unauthorized)
                {
                    System.Windows.MessageBox.Show("Your session has expired please login.", "Session expired", MessageBoxButton.OK);
                    WebContextBase.Current.Authentication.Logout(null, null);
                    e.Handled = true;
                    return;
                }
            }

            // If the app is running outside of the debugger then report the exception using
            // the browser's exception mechanism. On IE this will display it a yellow alert
            // icon in the status bar and Firefox will display a script error.
            if (!System.Diagnostics.Debugger.IsAttached)
            {

                // NOTE: This will allow the application to continue running after an exception has been thrown
                // but not handled.
                // For production applications this error handling should be replaced with something that will
                // report the error to the website and stop the application.
                e.Handled = true;
                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
            }
        }
开发者ID:ynosa,项目名称:KanbanBoard,代码行数:27,代码来源:App.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Windows.CornerRadius类代码示例发布时间:2022-05-26
下一篇:
C# Windows.Application类代码示例发布时间: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