-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
118 lines (108 loc) · 3.29 KB
/
Program.cs
File metadata and controls
118 lines (108 loc) · 3.29 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using System;
#if WINDOWS && DEBUG
using System.Windows.Forms;
#elif MONOMAC
using AppKit;
using Foundation;
#elif IOS
using Foundation;
using UIKit;
#endif
namespace ESuite
{
#if MONOMAC
class Program
{
static void Main(string[] args)
{
NSApplication.Init();
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
}
class AppDelegate : NSApplicationDelegate
{
private SmartScopeGui game;
public override void DidFinishLaunching(NSNotification notification)
{
AppDomain currentDomain = default(AppDomain);
currentDomain = AppDomain.CurrentDomain;
// Handler for unhandled exceptions.
currentDomain.UnhandledException += CrashLogger.GlobalUnhandledExceptionHandler;
game = new SmartScopeGui();
game.Run();
game.Dispose();
}
public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
{
return true;
}
}
#elif IOS
class Program
{
static void Main (string [] args)
{
UIApplication.Main (args,null,"AppDelegate");
}
}
[Register ("AppDelegate")]
class AppDelegate : UIApplicationDelegate
{
private SmartScopeGui game;
public override void FinishedLaunching (UIApplication app)
{
// Fun begins..
app.IdleTimerDisabled = true;
game = new SmartScopeGui();
game.Run();
}
public override void DidEnterBackground(UIApplication application)
{
game.Pause();
}
public override void OnActivated(UIApplication application)
{
game.Resume();
}
}
#elif !WINDOWS_PHONE
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
AppDomain currentDomain = default(AppDomain);
currentDomain = AppDomain.CurrentDomain;
// Handler for unhandled exceptions.
currentDomain.UnhandledException += CrashLogger.GlobalUnhandledExceptionHandler;
#if WINDOWS && DEBUG
//Winer case: on Windows the Crashlogger gets the right StoragePath, but afterwards the Storagepath is wrong; perhaps because this crashlogger is running in a differen domain. So in this new approach this sets the StoragePath.
Type type = typeof(DummyClassToGetStoragePathCorrect);
currentDomain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
#else
using (var game = new SmartScopeGui())
game.Run();
#endif
}
}
#if WINDOWS
//Winer case: on Windows the Crashlogger gets the right StoragePath, but afterwards the Storagepath is wrong; perhaps because this crashlogger is running in a differen domain. So in this new approach this sets the StoragePath.
public class DummyClassToGetStoragePathCorrect
{
public DummyClassToGetStoragePathCorrect()
{
string dummy = LabNation.Common.Utils.StoragePath;
}
}
#endif
#endif
}