-
Notifications
You must be signed in to change notification settings - Fork 10
/
AppManager.cs
64 lines (58 loc) · 1.83 KB
/
AppManager.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
61
62
63
64
using System;
using Xamarin.UITest;
using System.IO;
using NUnit.Framework;
using System.Reflection;
namespace Xamarin.UITest.SpecFlow
{
static class AppManager
{
static IApp app;
public static IApp App
{
get
{
if (app == null)
throw new NullReferenceException("'AppManager.App' not set. Call 'AppManager.StartApp()' before trying to access it.");
return app;
}
}
static Platform? platform;
public static Platform Platform
{
get
{
if (platform == null)
throw new NullReferenceException("'AppManager.Platform' not set.");
return platform.Value;
}
set
{
platform = value;
}
}
public static void StartApp()
{
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string binariesFolder = Path.Combine(assemblyFolder, "..", "..", "..", "Binaries");
if (Platform == Platform.Android)
{
app = ConfigureApp
.Android
// Used to run a .apk file:
.ApkFile(Path.Combine(binariesFolder, "TaskyDroid.apk"))
.StartApp();
}
if (Platform == Platform.iOS)
{
app = ConfigureApp
.iOS
// Used to run a .app file on an ios simulator:
.AppBundle(Path.Combine(binariesFolder, "TaskyiOS.app"))
// Used to run a .ipa file on a physical ios device:
//.InstalledApp("com.company.bundleid")
.StartApp();
}
}
}
}