mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Threading;
|
|
using NLog;
|
|
using WpfExceptionViewer;
|
|
|
|
namespace Artemis
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
public App()
|
|
{
|
|
//using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/SpoinkyNL/Artemis"))
|
|
//using (var mgr = new UpdateManager("C:\\Users\\Robert\\Desktop\\Artemis builds\\squirrel_test"))
|
|
//{
|
|
// SquirrelAwareApp.HandleEvents(
|
|
// onInitialInstall: v => mgr.CreateShortcutForThisExe(),
|
|
// onAppUpdate: v => Updater.AppUpdate(mgr),
|
|
// onAppUninstall: v => Updater.AppUninstall(mgr));
|
|
//}
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool DoHandle { get; set; }
|
|
|
|
protected override void OnExit(ExitEventArgs e)
|
|
{
|
|
base.OnExit(e);
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
|
{
|
|
if (DoHandle)
|
|
{
|
|
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
|
e.Handled = true;
|
|
}
|
|
else
|
|
{
|
|
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
|
e.Handled = false;
|
|
}
|
|
}
|
|
|
|
private static ExceptionViewer GetArtemisExceptionViewer(Exception e)
|
|
{
|
|
var logger = LogManager.GetCurrentClassLogger();
|
|
logger.Fatal(e, "Unhandled exception, showing dialog and shutting down.");
|
|
return new ExceptionViewer("An unexpected error occurred in Artemis.", e)
|
|
{
|
|
Title = "Artemis - Exception :c",
|
|
Height = 400,
|
|
Width = 800
|
|
};
|
|
}
|
|
}
|
|
} |