-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppDelegate.cs
44 lines (36 loc) · 1.23 KB
/
AppDelegate.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
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using IosSimulatorClientBinding;
namespace SimulatorLaunchSample
{
public partial class AppDelegate : NSApplicationDelegate
{
MainWindowController mainWindowController;
public AppDelegate ()
{
}
public override void FinishedLaunching (NSObject notification)
{
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);
StartSim(false, "[path to the .app you wish to launch on the simulator]");
}
private bool StartSim(bool iPad, string appPath)
{
var appSpec = DTiPhoneSimulatorApplicationSpecifier.SpecifierWithApplicationPath (appPath);
var sdkRoot = DtiPhoneSimulatorSystemRoot.DefaultRoot;
var config = new DtiPhoneSimulatorSessionConfig ();
config.ApplicationToSimulateOnStart = appSpec;
config.SimulatedSystemRoot = sdkRoot;
config.SimulatedApplicationShouldWaitForDebugger = false;
config.LocalizedClientName = new NSString("ios-sim2");
config.SimulatedDeviceFamily = iPad ? 2 : 1;
var session = new DtiPhoneSimulatorSession ();
NSError error;
return session.RequestStartWithConfig (config, 30, out error);
}
}
}