Exemplo n.º 1
0
 /// <summary>
 /// If an error occurs during navigation, show an error window
 /// </summary>
 private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     e.Handled = true;
     ErrorWindow.CreateNew(e.Exception);
 }
Exemplo n.º 2
0
        /// <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();
        }