-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
60 lines (48 loc) · 2.26 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
56
57
58
59
60
// Copyright (c) 2016 SolarLiner - Part of the TLE Orbiter Sceneraio Generator (TLEOSG)
using System;
using System.Windows.Forms;
namespace TLEOrbiter
{
static class Program
{
static bool ShowMessageBox;
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main()
{
Log.Init();
Log.Write("Starting application");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Settings.Load();
PluginManager.PluginManager.LoadPlugins();
//Application.CurrentCulture = Settings.Lang;
Application.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = Settings.Lang;
//Application.CurrentCulture.NumberFormat = System.Globalization.CultureInfo.InvariantCulture.NumberFormat; // To parse point separated decimals
Log.Write("Culture: " + Application.CurrentCulture.EnglishName);
Log.Write("Culture: Decimal point: " + Application.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
Application.SetCompatibleTextRenderingDefault(false);
ShowMessageBox = true;
Application.Run(new MainForm());
ShowMessageBox = false;
Settings.Save();
Log.Write("Bye!");
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
Log.WriteError(ex);
if (e.IsTerminating) Log.Write("[ERROR] Fatal error, terminating...");
if (ShowMessageBox)
{
if(e.IsTerminating)
MessageBox.Show(ex.Message + "\nThis is a fatal error and the app will close. Please send TLEOrbiter.log as a bug", "TLE Scenario Generator fatal error", MessageBoxButtons.OK);
else
MessageBox.Show(ex.Message + "\nPlease send TLEOrbiter.log as a bug after you close the app.", "TLE Scenario Generator error", MessageBoxButtons.OK);
}
}
}
}