diff --git a/GreenshotLanguageEditor/App.xaml.cs b/GreenshotLanguageEditor/App.xaml.cs index fd4d50b9c..88f1efc19 100644 --- a/GreenshotLanguageEditor/App.xaml.cs +++ b/GreenshotLanguageEditor/App.xaml.cs @@ -1,15 +1,21 @@ using System; using System.Windows; +using System.Windows.Threading; using System.Data; using System.Xml; using System.Configuration; -namespace GreenshotLanguageEditor -{ +namespace GreenshotLanguageEditor { /// /// Interaction logic for App.xaml /// - public partial class App : Application - { + public partial class App : Application { + public App() :base () { + this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); + } + void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { + new ErrorWindow(e.Exception).ShowDialog(); + e.Handled = true; + } } } \ No newline at end of file diff --git a/GreenshotLanguageEditor/ErrorWindow.xaml.cs b/GreenshotLanguageEditor/ErrorWindow.xaml.cs index b5ef9a962..9f15b8be5 100644 --- a/GreenshotLanguageEditor/ErrorWindow.xaml.cs +++ b/GreenshotLanguageEditor/ErrorWindow.xaml.cs @@ -15,6 +15,7 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using Greenshot.Helpers; namespace GreenshotLanguageEditor { @@ -23,11 +24,14 @@ namespace GreenshotLanguageEditor /// public partial class ErrorWindow : Window { - public ErrorWindow(string msg) + public ErrorWindow(Exception e) { InitializeComponent(); + this.Title = "Unexpected Error in GreenshotLanguageEditor"; - this.textBox.Text = msg; + this.textBox.Text = "Sorry, an unexpected error occurred :(\n\n" + + EnvironmentInfo.BuildReport(e); + } } } \ No newline at end of file