diff --git a/Winium/Microsoft.Phone.Tools.Deploy.Patched/Microsoft.Phone.Tools.Deploy.Patched.csproj b/Winium/Microsoft.Phone.Tools.Deploy.Patched/Microsoft.Phone.Tools.Deploy.Patched.csproj
index 4f85007..12051d6 100644
--- a/Winium/Microsoft.Phone.Tools.Deploy.Patched/Microsoft.Phone.Tools.Deploy.Patched.csproj
+++ b/Winium/Microsoft.Phone.Tools.Deploy.Patched/Microsoft.Phone.Tools.Deploy.Patched.csproj
@@ -20,6 +20,7 @@
x86
prompt
MinimumRecommendedRules.ruleset
+ 5
bin\x86\Release\
diff --git a/Winium/Winium.Mobile.Common/Winium.Mobile.Common.csproj b/Winium/Winium.Mobile.Common/Winium.Mobile.Common.csproj
index 0671718..71e115f 100644
--- a/Winium/Winium.Mobile.Common/Winium.Mobile.Common.csproj
+++ b/Winium/Winium.Mobile.Common/Winium.Mobile.Common.csproj
@@ -26,6 +26,7 @@
DEBUG;TRACE
prompt
4
+ 5
pdbonly
diff --git a/Winium/Winium.Mobile.Connectivity/AppType.cs b/Winium/Winium.Mobile.Connectivity/AppType.cs
new file mode 100644
index 0000000..85c99f9
--- /dev/null
+++ b/Winium/Winium.Mobile.Connectivity/AppType.cs
@@ -0,0 +1,9 @@
+namespace Winium.Mobile.Connectivity
+{
+ public enum AppType
+ {
+ XAP = Microsoft.Phone.Tools.Deploy.TypeOfApp.XAP,
+ APPX = Microsoft.Phone.Tools.Deploy.TypeOfApp.APPX,
+ APPXBUNDLE = Microsoft.Phone.Tools.Deploy.TypeOfApp.APPXBUNDLE
+ }
+}
diff --git a/Winium/Winium.Mobile.Connectivity/Deployer.cs b/Winium/Winium.Mobile.Connectivity/Deployer.cs
index 5cfd723..37fd25f 100644
--- a/Winium/Winium.Mobile.Connectivity/Deployer.cs
+++ b/Winium/Winium.Mobile.Connectivity/Deployer.cs
@@ -52,8 +52,8 @@ public Deployer(string desiredDevice, bool strict)
{
throw new AutomationException(
string.Format(
- "Could not find a device to launch. You requested '{0}', but the available devices were:\n{1}",
- desiredDevice,
+ "Could not find a device to launch. You requested '{0}', but the available devices were:\n{1}",
+ desiredDevice,
Devices.Instance));
}
@@ -77,6 +77,8 @@ public string DeviceName
}
}
+ public AppType AppType { get; private set; }
+
#endregion
#region Properties
@@ -99,6 +101,7 @@ public void UsePreInstalledApplication(string appPath)
{
var appManifest = Utils.ReadAppManifestInfoFromPackage(appPath);
this.RemoteApplication = this.Device.GetApplication(appManifest.ProductId);
+ this.AppType = DetermineAppType(appPath);
}
public void Launch()
@@ -134,9 +137,18 @@ public void SendFiles(List> files)
}
}
- public void Terminate()
+ public bool Terminate()
{
- throw new NotImplementedException("Deployer.Terminate");
+ if (this.AppType == AppType.XAP)
+ {
+ this.RemoteApplication.TerminateRunningInstances();
+ return true;
+ }
+ else
+ {
+ Logger.Debug("Could not terminate application from outside.");
+ return false;
+ }
}
public void Uninstall()
@@ -152,16 +164,35 @@ public void Uninstall()
this.Device.Disconnect();
}
-
#endregion
#region Methods
+ private static AppType DetermineAppType(string packagePath)
+ {
+ var extension = Path.GetExtension(packagePath);
+ if (!string.IsNullOrEmpty(extension))
+ {
+ switch (extension.ToLower(CultureInfo.InvariantCulture))
+ {
+ case ".appxbundle":
+ return AppType.APPXBUNDLE;
+ case ".appx":
+ return AppType.APPX;
+ case ".xap":
+ return AppType.XAP;
+ }
+ }
+
+ throw new NotImplementedException("This file extension is not supported by the tool.");
+ }
+
private void InstallApp(string appPath)
{
var appManifestInfo = this.InstallApplicationPackage(appPath);
this.installed = true;
this.RemoteApplication = this.Device.GetApplication(appManifestInfo.ProductId);
+ this.AppType = DetermineAppType(appPath);
}
private IAppManifestInfo InstallApplicationPackage(string path)
diff --git a/Winium/Winium.Mobile.Connectivity/IDeployer.cs b/Winium/Winium.Mobile.Connectivity/IDeployer.cs
index 791cc21..838bd2c 100644
--- a/Winium/Winium.Mobile.Connectivity/IDeployer.cs
+++ b/Winium/Winium.Mobile.Connectivity/IDeployer.cs
@@ -12,6 +12,8 @@ public interface IDeployer
string DeviceName { get; }
+ AppType AppType { get; }
+
#endregion
#region Public Methods and Operators
@@ -28,7 +30,7 @@ public interface IDeployer
void SendFile(string isoStoreRoot, string sourceDesktopFilePath, string targetDeviceFilePath);
- void Terminate();
+ bool Terminate();
void Uninstall();
diff --git a/Winium/Winium.Mobile.Connectivity/Winium.Mobile.Connectivity.csproj b/Winium/Winium.Mobile.Connectivity/Winium.Mobile.Connectivity.csproj
index 8d2a959..e8f1a05 100644
--- a/Winium/Winium.Mobile.Connectivity/Winium.Mobile.Connectivity.csproj
+++ b/Winium/Winium.Mobile.Connectivity/Winium.Mobile.Connectivity.csproj
@@ -20,6 +20,7 @@
x86
prompt
MinimumRecommendedRules.ruleset
+ 5
bin\x86\Release\
@@ -66,6 +67,7 @@
+
diff --git a/Winium/Winium.Mobile.Driver/CommandExecutors/CloseAppExecutor.cs b/Winium/Winium.Mobile.Driver/CommandExecutors/CloseAppExecutor.cs
index ad7a573..d0953d1 100644
--- a/Winium/Winium.Mobile.Driver/CommandExecutors/CloseAppExecutor.cs
+++ b/Winium/Winium.Mobile.Driver/CommandExecutors/CloseAppExecutor.cs
@@ -1,5 +1,6 @@
namespace Winium.Mobile.Driver.CommandExecutors
{
+ using Connectivity;
using System;
using System.Threading;
@@ -12,9 +13,13 @@ internal class CloseAppExecutor : CommandExecutorBase
public static void CloseApp(Automator automator)
{
- var remoteCommand = new Command(DriverCommand.CloseApp);
- automator.CommandForwarder.ForwardCommand(remoteCommand);
- Thread.Sleep(TimeSpan.FromMilliseconds(500));
+ var terminated = automator.Deployer.Terminate();
+ if (!terminated)
+ {
+ var remoteCommand = new Command(DriverCommand.CloseApp);
+ automator.CommandForwarder.ForwardCommand(remoteCommand);
+ Thread.Sleep(TimeSpan.FromMilliseconds(500));
+ }
}
#endregion
diff --git a/Winium/Winium.Mobile.Driver/Winium.Mobile.Driver.csproj b/Winium/Winium.Mobile.Driver/Winium.Mobile.Driver.csproj
index 1e14598..462b8a9 100644
--- a/Winium/Winium.Mobile.Driver/Winium.Mobile.Driver.csproj
+++ b/Winium/Winium.Mobile.Driver/Winium.Mobile.Driver.csproj
@@ -25,6 +25,7 @@
prompt
MinimumRecommendedRules.ruleset
true
+ 5
bin\x86\Release\
diff --git a/Winium/Winium.Mobile.Logging/Winium.Mobile.Logging.csproj b/Winium/Winium.Mobile.Logging/Winium.Mobile.Logging.csproj
index ba42856..8ceeeaa 100644
--- a/Winium/Winium.Mobile.Logging/Winium.Mobile.Logging.csproj
+++ b/Winium/Winium.Mobile.Logging/Winium.Mobile.Logging.csproj
@@ -22,6 +22,7 @@
DEBUG;TRACE
prompt
4
+ 5
pdbonly
diff --git a/Winium/Winium.Silverlight.InnerServer/Winium.Silverlight.InnerServer.csproj b/Winium/Winium.Silverlight.InnerServer/Winium.Silverlight.InnerServer.csproj
index b77c031..07afad0 100644
--- a/Winium/Winium.Silverlight.InnerServer/Winium.Silverlight.InnerServer.csproj
+++ b/Winium/Winium.Silverlight.InnerServer/Winium.Silverlight.InnerServer.csproj
@@ -34,6 +34,7 @@
true
prompt
4
+ 5
pdbonly
diff --git a/Winium/Winium.StoreApps.InnerServer/Winium.StoreApps.InnerServer.csproj b/Winium/Winium.StoreApps.InnerServer/Winium.StoreApps.InnerServer.csproj
index 5aa99e3..b165b19 100644
--- a/Winium/Winium.StoreApps.InnerServer/Winium.StoreApps.InnerServer.csproj
+++ b/Winium/Winium.StoreApps.InnerServer/Winium.StoreApps.InnerServer.csproj
@@ -26,6 +26,7 @@
DEBUG;TRACE
prompt
4
+ 5
pdbonly
diff --git a/Winium/Winium.StoreApps.Inspector/Winium.StoreApps.Inspector.csproj b/Winium/Winium.StoreApps.Inspector/Winium.StoreApps.Inspector.csproj
index 6d394e4..1c4ba72 100644
--- a/Winium/Winium.StoreApps.Inspector/Winium.StoreApps.Inspector.csproj
+++ b/Winium/Winium.StoreApps.Inspector/Winium.StoreApps.Inspector.csproj
@@ -42,6 +42,7 @@
prompt
4
MinimumRecommendedRules.ruleset
+ 5
AnyCPU