-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
52 lines (44 loc) · 2.16 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Threading.Tasks;
using System.Windows;
namespace MSB_SERVER
{
public partial class App
{
public NetworkManager networkManager;
public DatabaseManager databaseManager;
public LogManager logManager;
public StatusManager statusManager;
public GraphicalManager graphicalManager;
public ServerManager serverManager;
public CommandManager commandManager;
private void OnStartup(object sender, StartupEventArgs eventArgs)
{
networkManager = NetworkManager.GetInstance();
databaseManager = DatabaseManager.GetInstance();
logManager = LogManager.GetInstance();
statusManager = StatusManager.GetInstance();
graphicalManager = GraphicalManager.GetInstance();
serverManager = ServerManager.GetInstance();
commandManager = CommandManager.GetInstance();
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
MSBUnhandledException((Exception) e.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException");
DispatcherUnhandledException += (s, e) =>
MSBUnhandledException(e.Exception, "Application.Current.DispatcherUnhandledException");
TaskScheduler.UnobservedTaskException += (s, e) =>
MSBUnhandledException(e.Exception, "TaskScheduler.UnobservedTaskException");
graphicalManager.ShowGraphicalUserInterface();
commandManager.StartController();
}
public void MSBUnhandledException(Exception e, string sender)
{
logManager.NewLog(LogManager.LOG_LEVEL.LOG_CRITICAL, LogManager.LOG_TARGET.LOG_SYSTEM, "***CRITICAL ERROR***", sender);
logManager.NewLog(LogManager.LOG_LEVEL.LOG_CRITICAL, LogManager.LOG_TARGET.LOG_SYSTEM, "***ERROR MESSAGE***", e.Message);
logManager.NewLog(LogManager.LOG_LEVEL.LOG_CRITICAL, LogManager.LOG_TARGET.LOG_SYSTEM, "***STACK TRACE***", e.StackTrace);
}
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MSBUnhandledException(e.Exception, sender.ToString());
}
}
}