public static void ShowErrorDialog(string message, string stackTrace, string clipboardText, bool isFatalError, string caption = "")
		{
			if (Application.Current != null && Application.Current.Dispatcher != null)
			{
				Application.Current.Dispatcher.Invoke(() =>
					{
						var errorDialog = new ErrorDialog()
							{
								Caption = caption,
								StackTrace = stackTrace,
								ClipboardText = clipboardText,
								Message = message,
								IsFatalError = isFatalError,
							};
						if (Application.Current.MainWindow != null)
						{
							errorDialog.Owner = Application.Current.MainWindow;
							errorDialog.Width = Application.Current.MainWindow.ActualWidth;
							errorDialog.MaxHeight = Application.Current.MainWindow.ActualHeight - 100;
						}
						errorDialog.ShowDialog();
					});
			}
			else
			{
				Trace.WriteLine("ShowErrorDialog" + message);
				Console.WriteLine(message);
				Debug.WriteLine(message);
			}
		}
Beispiel #2
0
		private static void ShowErrDialog(Exception e)
		{
			App.Current.Dispatcher.Invoke(new Action(() =>
			{
				var dlg = new ErrorDialog
				{
					StackTrace = e.StackTrace,
					Message = string.Format("An unhandled exception occurred: {0}", e.Message),
					ClipboardText = e.ToString(),
					Owner = App.Current.MainWindow
				};
				dlg.ShowDialog();
			}));

		}