Windows phone 未处理异常的 错误报告页面

it2022-05-05  109

1.创建ErrorPage页面,增加如下代码:

        public static Exception Exception;

        // Executes when the user navigates to this page.         protected override void OnNavigatedTo(NavigationEventArgs e)         {             ErrorText.Text = Exception.ToString();         }

 

2.修改App页面:

// 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();             }            e.Handled = true;

            //theException 这是一个静态成员,所以通过类名直接访问。             ErrorPage.theException = e.ExceptionObject;             (RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame).Source = new Uri("/ErrorPage.xaml",UriKind.Relative);         }

转载于:https://www.cnblogs.com/binaryworms/archive/2012/06/27/2565831.html

相关资源:各显卡算力对照表!

最新回复(0)