mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-29 02:01:19 +00:00
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using MessageBox = System.Windows.Forms.MessageBox;
|
|
|
|
namespace WeModPatcher
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App
|
|
{
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
{
|
|
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
|
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
|
base.OnStartup(e);
|
|
}
|
|
|
|
private void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
|
|
{
|
|
MessageBox.Show(e.ToString());
|
|
Shutdown();
|
|
}
|
|
|
|
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
MessageBox.Show(e.ToString());
|
|
Shutdown();
|
|
}
|
|
|
|
public new static void Shutdown()
|
|
{
|
|
Current.Dispatcher.Invoke(() => Current.Shutdown());
|
|
}
|
|
}
|
|
} |