/// <summary> /// Creates instance of <see cref="ErrorWindow"/> for all other factory Report methods will result in a call to this one /// </summary> /// <param name="message">Which message to display</param> /// <param name="stackTrace">The associated stack trace</param> /// <param name="policy">In which situations the stack trace should be appended to the message</param> private static void Report(string message, string stackTrace, ErrorShowStackTrace policy) { string errorDetails = string.Empty; if (NavigationApp.ErrorPolicy == ErrorShowStackTrace.Always || policy == ErrorShowStackTrace.Always || policy == ErrorShowStackTrace.OnlyWhenDebugging && Debugger.IsAttached) { errorDetails = stackTrace ?? string.Empty; } if (Debugger.IsAttached) { DebugManager.LogError(message + Environment.NewLine + stackTrace); } var ew = new ErrorWindow(message, errorDetails); ew.ShowDialog(); }
/// <summary> /// Creates a new Error Window given an error message. /// </summary> public static void Report(string message, ErrorShowStackTrace policy) { Report(message, new StackTrace().ToString(), policy); }
/// <summary> /// Creates a new Error Window given an exception.> /// </summary> public static void Report(Exception exception, ErrorShowStackTrace policy) { var error = new ErrorStackMessage(exception); Report(error.Message, error.Stack, policy); }