Ejemplo n.º 1
0
		private void TrySaveBuiltApp(AppInfo appInfo, byte[] appData)
		{
			if (!Directory.Exists(AppStorageDirectory))
				Directory.CreateDirectory(AppStorageDirectory); // ncrunch: no coverage
			string appSavePath = Path.Combine(AppStorageDirectory, Path.GetFileName(appInfo.FilePath));
			File.WriteAllBytes(appSavePath, appData);
		}
Ejemplo n.º 2
0
 // ncrunch: no coverage start
 public static void HandleNoDeviceAvailableInView(AppInfo appInfo)
 {
     LogNoDeviceAvailable(appInfo);
     if (appInfo is Android.AndroidAppInfo)
         if (ShowDownloadAndroidDriversQuestionAndGetUserDecision() == MessageBoxResult.Yes)
             TryDownloadAndroidDriverAndShowInstructions();
 }
Ejemplo n.º 3
0
 private static void TryLaunchApp(AppInfo selectedApp, Action enableLaunchButtonAgain)
 {
     try
     {
         if (!selectedApp.IsDeviceAvailable)
         {
             AppInfoExtensions.HandleNoDeviceAvailableInView(selectedApp);
             return;
         }
         Device primaryDevice = selectedApp.AvailableDevices[0];
         if (!primaryDevice.IsAppInstalled(selectedApp))
         {
             Logger.Info(selectedApp + " wasn't installed on the device '" + primaryDevice +
                 "' will install it now.");
             primaryDevice.Install(selectedApp);
         }
         selectedApp.LaunchAppOnPrimaryDevice();
     }
     catch (Device.StartApplicationFailedOnDevice ex)
     {
         AppInfoExtensions.LogStartingAppFailed(selectedApp, ex.DeviceName);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
     enableLaunchButtonAgain();
 }
Ejemplo n.º 4
0
		// ncrunch: no coverage start
		protected override void LaunchApp(AppInfo app)
		{
			string appFileDirectory = Path.GetDirectoryName(app.FilePath);
			if (appFileDirectory.Length == 0)
				appFileDirectory = Environment.CurrentDirectory;
			Process.Start(appFileDirectory);
		}
Ejemplo n.º 5
0
 public void Uninstall(AppInfo app)
 {
     if (app == null)
         throw new NoAppSpecified();
     if (IsAppInstalled(app))
         UninstallApp(app);
 }
Ejemplo n.º 6
0
		private void TryLaunch(AppInfo app)
		{
			if (app == null)
				throw new NoAppSpecified();
			if (!IsAppInstalled(app))
				throw new AppNotInstalled(this, app);
			LaunchApp(app);
		}
Ejemplo n.º 7
0
 public void AddApp(AppInfo appInfo, byte[] appData = null)
 {
     if (appInfo == null)
         throw new NoAppInfoSpecified();
     appsStorage.AddApp(appInfo);
     RaisePropertyChangedOfBuiltApps();
     if (appData != null)
         SaveBuiltApp(appInfo, appData);
 }
Ejemplo n.º 8
0
		// ncrunch: no coverage end

		public void Launch(AppInfo app)
		{
			try
			{
				TryLaunch(app);
			}
			catch (Exception ex)
			{
				throw new StartApplicationFailedOnDevice(Name, ex);
			}
		}
Ejemplo n.º 9
0
		private void SaveBuiltApp(AppInfo appInfo, byte[] appData)
		{
			try
			{
				TrySaveBuiltApp(appInfo, appData);
			}
			// ncrunch: no coverage start
			catch (Exception ex)
			{
				throw new SavingBuiltAppFailed(ex);
			}
			// ncrunch: no coverage end
		}
Ejemplo n.º 10
0
 public void AddApp(AppInfo app)
 {
     int indexOfApp = GetIndexOfAppInAvailableAppsList(app);
     if (indexOfApp != InvalidIndex)
     {
         availableApps[indexOfApp] = app;
         UpdateStorageDataInSettings();
     }
     else
     {
         availableApps.Add(app);
         AddAppToStorageData(app);
     }
 }
Ejemplo n.º 11
0
 public void Launch(AppInfo app)
 {
     try
     {
         if (app == null)
             throw new NoAppSpecified();
         if (!IsAppInstalled(app))
             throw new AppNotInstalled(this, app);
         LaunchApp(app);
     }
     catch (Exception ex)
     {
         throw new StartApplicationFailedOnDevice(Name, ex);
     }
 }
Ejemplo n.º 12
0
		private static void LaunchApp(AppInfo selectedApp, Action enableLaunchButtonAgain)
		{
			try
			{
				TryLaunchApp(selectedApp);
			}
			catch (Device.StartApplicationFailedOnDevice ex)
			{
				AppInfoExtensions.LogStartingAppFailed(selectedApp, ex.DeviceName);
			}
			catch (Exception ex)
			{
				Logger.Error(ex);
			}
			enableLaunchButtonAgain();
		}
Ejemplo n.º 13
0
		private static void TryLaunchApp(AppInfo selectedApp)
		{
			if (!selectedApp.IsDeviceAvailable)
			{
				AppInfoExtensions.HandleNoDeviceAvailableInView(selectedApp);
				return;
			}
			Device primaryDevice = selectedApp.AvailableDevices[0];
			if (!primaryDevice.IsAppInstalled(selectedApp))
			{
				Logger.Info(selectedApp + " wasn't installed on the device '" + primaryDevice +
					"' will install it now.");
				primaryDevice.Install(selectedApp);
			}
			selectedApp.LaunchAppOnPrimaryDevice();
		}
Ejemplo n.º 14
0
 protected abstract void UninstallApp(AppInfo app);
Ejemplo n.º 15
0
		// ncrunch: no coverage start
		private void OnAppRebuildRequest(AppInfo app)
		{
			SendBuildRequestToServer(app.SolutionFilePath, app.Name, app.Platform, true);
		}
Ejemplo n.º 16
0
		public void InstallAndLaunchNewBuiltApp(AppInfo appInfo)
		{
			if (!appInfo.IsDeviceAvailable)
			{
				AppInfoExtensions.HandleNoDeviceAvailableInView(appInfo);
				UpdateBuildProgressBar("Launching App aborted", 100);
				ViewModel.OpenLocalBuiltAppsDirectory();
				return;
			}
			Device primaryDevice = appInfo.AvailableDevices[0];
			if (primaryDevice.IsAppInstalled(appInfo))
			{
				UpdateBuildProgressBar(appInfo.Name + " was already installed, uninstalling it.", 90);
				primaryDevice.Uninstall(appInfo);
			}
			UpdateBuildProgressBar("Installing " + appInfo.Name + " on " + primaryDevice.Name, 95);
			primaryDevice.Install(appInfo);
			LaunchApp(appInfo, primaryDevice);
		}
Ejemplo n.º 17
0
		private void DispatchAndHandleBuildAppReceivedEvent(AppInfo appInfo, byte[] appData)
		{
			Dispatcher.BeginInvoke(new Action(() => OnBuiltAppRecieved(appInfo, appData)));
		}
Ejemplo n.º 18
0
		private void TryLaunchApp(AppInfo appInfo, Device device)
		{
			UpdateBuildProgressBar("App launched", 100);
			device.Launch(appInfo);
		}
Ejemplo n.º 19
0
 private void TryLaunchApp(AppInfo appInfo, Device device)
 {
     try
     {
         UpdateBuildProgressBar("App launched", 100);
         device.Launch(appInfo);
     }
     catch (Device.StartApplicationFailedOnDevice ex)
     {
         AppInfoExtensions.LogStartingAppFailed(appInfo, ex.DeviceName);
     }
 }
Ejemplo n.º 20
0
		private int GetIndexOfAppInAvailableAppsList(AppInfo app)
		{
			return availableApps.FindIndex(a => a.Name == app.Name && a.Platform == app.Platform);
		}
Ejemplo n.º 21
0
 private void DispatchAndHandleBuildAppReceivedEvent(AppInfo appInfo, byte[] appData)
 {
     Dispatcher.BeginInvoke(new Action(() => OnBuiltAppRecieved(appInfo, appData)));
 }
Ejemplo n.º 22
0
 public AppNotInstalled(Device device, AppInfo app)
     : base(app.Name + " on " + device)
 {
 }
Ejemplo n.º 23
0
 public UninstallationFailedOnDevice(Device device, AppInfo app)
     : base(app.Name + " on " + device)
 {
 }
Ejemplo n.º 24
0
 private static void LogNoDeviceAvailable(AppInfo appToStart)
 {
     Logger.Warning("No " + appToStart.Platform + " device found. Please make sure your" +
                    " device is connected and you have the correct driver installed.");
 }
Ejemplo n.º 25
0
 public static void LogStartingAppFailed(AppInfo appToStart, string deviceName)
 {
     Logger.Warning(appToStart.Name + " can't be started on your " + appToStart.Platform +
                    " device (" + deviceName + "). Please make sure your device is connected and the app was" +
                    " correctly installed.");
 }
Ejemplo n.º 26
0
 public NoDeviceAvailable(AppInfo appInfo)
     : base(appInfo.ToString())
 {
 }
Ejemplo n.º 27
0
 private int GetIndexOfAppInAvailableAppsList(AppInfo app)
 {
     return(availableApps.FindIndex(a => a.Name == app.Name && a.Platform == app.Platform));
 }
Ejemplo n.º 28
0
 private void OnBuiltAppRecieved(AppInfo appInfo, byte[] appData)
 {
     ViewModel.AppListViewModel.AddApp(appInfo, appData);
     SwitchToBuiltApps();
     InstallAndLaunchNewBuiltApp(appInfo);
 }
Ejemplo n.º 29
0
 public abstract bool IsAppInstalled(AppInfo app);
Ejemplo n.º 30
0
		private void AddAppToStorageData(AppInfo app)
		{
			var appDataNode = new XmlData("App");
			appDataNode.AddAttribute(XmlAttributeNameOfFileName, Path.GetFileName(app.FilePath));
			appDataNode.AddAttribute(XmlAttributeNameOfPlatform, app.Platform);
			appDataNode.AddAttribute(XmlAttributeNameOfAppGuid, app.AppGuid);
			appDataNode.AddAttribute(XmlAttributeNameOfBuildDate, app.BuildDate);
			appDataNode.AddAttribute(XmlAttributeNameOfSolutionFilePath, app.SolutionFilePath);
			storageData.AddChild(appDataNode);
			UpdateStorageDataInSettings();
		}
Ejemplo n.º 31
0
 private void SaveBuiltApp(AppInfo appInfo, byte[] appData)
 {
     try
     {
         if (!Directory.Exists(AppStorageDirectory))
             Directory.CreateDirectory(AppStorageDirectory); // ncrunch: no coverage
         string appSavePath = Path.Combine(AppStorageDirectory, Path.GetFileName(appInfo.FilePath));
         File.WriteAllBytes(appSavePath, appData);
     }
     catch (Exception ex)
     {
         throw new SavingBuiltAppFailed(ex);
     }
 }
Ejemplo n.º 32
0
		private void LaunchApp(AppInfo appInfo, Device device)
		{
			try
			{
				TryLaunchApp(appInfo, device);
			}
			catch (Device.StartApplicationFailedOnDevice ex)
			{
				AppInfoExtensions.LogStartingAppFailed(appInfo, ex.DeviceName);
			}
		}
Ejemplo n.º 33
0
 protected override void InstallApp(AppInfo app)
 {
 }
Ejemplo n.º 34
0
			public NoDeviceAvailable(AppInfo appInfo)
				: base(appInfo.ToString()) { }
Ejemplo n.º 35
0
 protected abstract void LaunchApp(AppInfo app);
Ejemplo n.º 36
0
		private void OnBuiltAppRecieved(AppInfo appInfo, byte[] appData)
		{
			ViewModel.AppListViewModel.AddApp(appInfo, appData);
			SwitchToBuiltApps();
			InstallAndLaunchNewBuiltApp(appInfo);
		}
Ejemplo n.º 37
0
 public AppNotInstalled(Device device, AppInfo app)
     : base(app.Name + " on " + device)
 {
 }
Ejemplo n.º 38
0
		private void TriggerBuiltAppRecieved(AppInfo appInfo, byte[] appData)
		{
			if (BuiltAppRecieved != null)
				BuiltAppRecieved(appInfo, appData);
		}
Ejemplo n.º 39
0
 protected abstract void LaunchApp(AppInfo app);
Ejemplo n.º 40
0
 public abstract bool IsAppInstalled(AppInfo app);
        private void OnRebuildAppClicked(object rebuildButton, RoutedEventArgs e)
        {
            AppInfo boundApp = GetBoundApp(rebuildButton);

            viewModel.RequestRebuild(boundApp);
        }
Ejemplo n.º 42
0
 protected override void UninstallApp(AppInfo app)
 {
     File.Delete(app.FilePath);
 }
Ejemplo n.º 43
0
 private void TryLaunchApp(AppInfo appInfo, Device device)
 {
     UpdateBuildProgressBar("App launched", 100);
     device.Launch(appInfo);
 }
Ejemplo n.º 44
0
 protected abstract void UninstallApp(AppInfo app);
Ejemplo n.º 45
0
 public override bool IsAppInstalled(AppInfo app)
 {
     return(File.Exists(app.FilePath));
 }
Ejemplo n.º 46
0
 public InstallationFailedOnDevice(Device device, AppInfo app)
     : base(app.Name + " on " + device)
 {
 }
Ejemplo n.º 47
0
 // ncrunch: no coverage start
 private void OnAppRebuildRequest(AppInfo app)
 {
     SendBuildRequestToServer(app.SolutionFilePath, app.Name, app.Platform, true);
 }