forked from mikefourie-zz/MSBuildExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
37 lines (33 loc) · 1.37 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//---------------------------------------------------------------------------------------------------------------------------
// <copyright file="App.xaml.cs">(c) Mike Fourie. All other rights reserved.</copyright>
//---------------------------------------------------------------------------------------------------------------------------
namespace MSBuildExplorer
{
using System.Windows;
/// <summary>
/// App
/// </summary>
public partial class App
{
public App()
{
this.Dispatcher.UnhandledException += this.OnDispatcherUnhandledException;
}
internal void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string exception = e.Exception.ToString();
if (e.Exception.InnerException != null)
{
exception += ". Inner Exception = " + e.Exception.InnerException;
}
string errorMessage = string.Format("{0}. Please report this error", exception);
MessageBox.Show(errorMessage, "Sorry, this was not meant to happen.", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
protected override void OnStartup(StartupEventArgs e)
{
WpfSingleInstance.Make();
base.OnStartup(e);
}
}
}