Esempio n. 1
0
        // Если во время навигации возникает ошибка, отобразить окно ошибки
        private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            e.Handled = true;
            ChildWindow errorWin = new ErrorWindow(e.Uri);

            errorWin.Show();
        }
        /// <summary>
        /// All other factory methods will result in a call to this one.
        /// </summary>
        /// <param name="message">The message to display</param>
        /// <param name="stackTrace">The associated stack trace</param>
        /// <param name="policy">The situations in which the stack trace should be appended to the message</param>
        private static void CreateNew(string message, string stackTrace, StackTracePolicy policy)
        {
            string errorDetails = string.Empty;

            if (policy == StackTracePolicy.Always ||
                policy == StackTracePolicy.OnlyWhenDebuggingOrRunningLocally && IsRunningUnderDebugOrLocalhost)
            {
                errorDetails = stackTrace ?? string.Empty;
            }

            ErrorWindow window = new ErrorWindow(message, errorDetails);

            window.Show();
        }
Esempio n. 3
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     // If the app is running outside of the debugger then report the exception using
     // a ChildWindow control.
     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;
         ChildWindow errorWin = new ErrorWindow(e.ExceptionObject);
         errorWin.Show();
     }
 }
Esempio n. 4
0
 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
 {
     // Если приложение выполняется вне отладчика, воспользуйтесь для сообщения об исключении
     // элементом управления ChildWindow.
     if (!System.Diagnostics.Debugger.IsAttached)
     {
         // ПРИМЕЧАНИЕ. Это позволит приложению выполняться после того, как исключение было выдано,
         // но не было обработано.
         // Для рабочих приложений такую обработку ошибок следует заменить на код,
         // оповещающий веб-сайт об ошибке и останавливающий работу приложения.
         e.Handled = true;
         ChildWindow errorWin = new ErrorWindow(e.ExceptionObject);
         errorWin.Show();
     }
 }
 // If an error occurs during navigation, show an error window
 private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     e.Handled = true;
     ChildWindow errorWin = new ErrorWindow(e.Uri);
     errorWin.Show();
 }