/platform/wp8/RhoAppRunner/Program.cs
C# | 99 lines | 56 code | 16 blank | 27 comment | 6 complexity | e5172265ff93c0d46b21e2589a1c8082 MD5 | raw file
Possible License(s): MIT, Apache-2.0, LGPL-2.1
- /*------------------------------------------------------------------------
- * (The MIT License)
- *
- * Copyright (c) 2008-2011 Rhomobile, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * http://rhomobile.com
- *------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Threading;
- using System.Reflection;
- using Microsoft.SmartDevice.Connectivity;
- namespace RhoAppRunner
- {
- class Program
- {
- static void Main(string[] args)
- {
- DatastoreManager dsmgrObj = new DatastoreManager(1033);
- Platform WP8SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "Windows Phone 8");
- bool useEmulator = true;
- Device WP8Device = null;
- if (args[4] == "dev")
- useEmulator = false;
- if (useEmulator)
- // WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Emulator") || d.Name.StartsWith("Windows Phone 8 Emulator"));
- WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Emulator WVGA"));
- else
- WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Device") || d.Name.StartsWith("Windows Phone 8 Device"));
- Console.WriteLine("Connecting to Windows Phone 8 Emulator/Device...");
- WP8Device.Connect();
- Console.WriteLine("Windows Phone 8 Emulator/Device Connected...");
- Guid appID = new Guid(args[0]);
- RemoteApplication app;
- if (WP8Device.IsApplicationInstalled(appID))
- {
- Console.WriteLine("Updating sample XAP to Windows Phone 8 Emulator/Device...");
- app = WP8Device.GetApplication(appID);
- //app.Uninstall();
- app.UpdateApplication(args[1],
- args[2],
- args[3]);
- Console.WriteLine("Sample XAP Updated on Windows Phone 8 Emulator/Device...");
- Console.WriteLine("Launching sample app on Windows Phone 8 Emulator...");
- app.Launch();
- Console.WriteLine("Launched sample app on Windows Phone 8 Emulator...");
- return;
- }
- Console.WriteLine("Installing sample XAP to Windows Phone 8 Emulator/Device...");
- app = WP8Device.InstallApplication(
- appID,
- appID,
- args[1],
- args[2],
- args[3]);
- Console.WriteLine("Sample XAP installed to Windows Phone 8 Emulator...");
- Console.WriteLine("Launching sample app on Windows Phone 8 Emulator...");
- app.Launch();
- Console.WriteLine("Launched sample app on Windows Phone 8 Emulator...");
- }
- }
- }