/
App.xaml.cs
22 lines (21 loc) · 967 Bytes
/
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
using System.Diagnostics;
using System.Windows;
using Azazel.FileSystem;
using Azazel.Logging;
namespace Azazel {
public partial class App {
protected override void OnStartup(StartupEventArgs e) {
var processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
ShutdownMode = ShutdownMode.OnExplicitShutdown;
if (processes.Length != 1) Shutdown();
var command = new MainWindowCommand(Shutdown);
command.Execute();
command.Collapse();
DispatcherUnhandledException += (sender, args) => {
LogManager.WriteLog(args.Exception);
File.WriteAllText(Paths.Instance.Exception, args.Exception.ToString());
};
Exit += (sender, args) => LogManager.WriteLog("exiting");
}
}
}