-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
55 lines (46 loc) · 1.84 KB
/
Program.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
53
54
55
using System;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using log4net;
using log4net.Config;
[assembly: XmlConfigurator(Watch = false)]
namespace SCHOTT.CVLS.Dashboard
{
internal static class Program
{
public static ILog Log = LogManager.GetLogger("SCHOTT.CVLS.Dashboard");
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
XmlConfigurator.Configure();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
Application.Run(new Dashboard());
}
private static void CurrentDomain_FirstChanceException(object sender, FirstChanceExceptionEventArgs e)
{
Log.Info(e.Exception.Message, e.Exception);
}
private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
Log.Error(e.Exception);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log.Error(e.ExceptionObject);
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Log.Error(e.Exception);
}
}
}