private void btnUpdate_Click(object sender, RoutedEventArgs e) { // RemoveEmptyEntries does not remove an entry that has a space, so don't waste time with it string[] files = txtXapFile.Text.Split(';'); Analytics.Instance.Track(Analytics.Categories.App, "Update", "Count", files.Length); Xap xap; IRemoteApplication existingInstall; RememberXapPaths(files); foreach (string file in files) { if (string.IsNullOrWhiteSpace(file)) { continue; } // trim filename, otherwise the native side of UpdateApplication gets annoyed xap = new Xap(file.Trim()); if (!_device.CurrentDevice.IsApplicationInstalled(xap.Guid)) { // TODO: notification to user continue; } existingInstall = _device.CurrentDevice.GetApplication(xap.Guid); existingInstall.UpdateApplication("genre", "noicon", xap.FilePath); } }
void loadXapFile() { btnDeploy.IsEnabled = false; if (File.Exists(tbXapPath.Text)) { Xap x = new Xap(tbXapPath.Text); x.Open(); xapIcon = (from xx in x.List where xx.Name == x.Meta["IconPath"] select xx).Single <XapEntry>().FullPath; xapGuid = x.Meta["ProductID"]; tbInfo.Inlines.Clear(); foreach (KeyValuePair <string, string> kv in x.Meta) { Run r = new Run(string.Format("{0}: ", kv.Key)); r.FontWeight = FontWeights.Bold; tbInfo.Inlines.Add(r); tbInfo.Inlines.Add(new LineBreak()); tbInfo.Inlines.Add(new Run(kv.Value)); tbInfo.Inlines.Add(new LineBreak()); tbInfo.Inlines.Add(new LineBreak()); } btnDeploy.IsEnabled = true; } else { MessageBox.Show("Invalid file path"); } }
/// <summary> Валидация </summary> public override IEnumerable <EntityValidationError> OnEntityValidating() { if (Xap == null || !Xap.Any()) { yield return(new EntityValidationError("Xap", ValidationErrors.Task_OnValidating_Указан_пустой_исполняемый_файл_задания_)); } }
private void btnInstall_Click(object sender, RoutedEventArgs e) { // RemoveEmptyEntries does not remove an entry that has a space, so don't waste time with it string[] files = txtXapFile.Text.Split(';'); Analytics.Instance.Track(Analytics.Categories.App, "Install", "Count", files.Length); Xap xap; IRemoteApplication existingInstall; RememberXapPaths(files); foreach (string file in files) { if (string.IsNullOrWhiteSpace(file)) { continue; } // trim filename, otherwise the native side of UpdateApplication gets annoyed xap = new Xap(file.Trim()); if (_device.CurrentDevice.IsApplicationInstalled(xap.Guid)) { existingInstall = _device.CurrentDevice.GetApplication(xap.Guid); existingInstall.Uninstall(); } try { _device.CurrentDevice.InstallApplication(xap.Guid, Guid.Empty, "genre", "noicon", xap.FilePath); } catch (SmartDeviceException ex) { if (ex.Message == "0x8103010B") { ShowError("Your xap (" + xap.Name + ") appears to target a newer OS than the one you are deploying to. Are you trying to deploy an 8.0 app to the 7.5 emulator?"); } else { throw; } } catch (OutOfMemoryException ex) { ShowError("You've run out of space on your device! Please try again (this can sometimes be a device API issue) and if the error persists remove some apps and then try again.\n\nRaw Error: " + ex.Message); break; } } _device.RefreshInstalledApps(); }
private static void Install(string xapFile) { Xap xap = new Xap(xapFile); RemoteApplicationEx app = GetApp(xap.Guid); // first uninstall any existing instances if (app != null) { app.RemoteApplication.Uninstall(); } _device.CurrentDevice.InstallApplication(xap.Guid, Guid.Empty, "genre", "noicon", xapFile); }
void loadXapFile() { btnDeploy.IsEnabled = false; if (File.Exists(tbXapPath.Text)) { Xap x = new Xap(tbXapPath.Text); x.Open(); xapIcon = (from xx in x.List where xx.Name == x.Meta["IconPath"] select xx).Single<XapEntry>().FullPath; xapGuid = x.Meta["ProductID"]; tbInfo.Inlines.Clear(); foreach (KeyValuePair<string, string> kv in x.Meta) { Run r = new Run(string.Format("{0}: ", kv.Key)); r.FontWeight = FontWeights.Bold; tbInfo.Inlines.Add(r); tbInfo.Inlines.Add(new LineBreak()); tbInfo.Inlines.Add(new Run(kv.Value)); tbInfo.Inlines.Add(new LineBreak()); tbInfo.Inlines.Add(new LineBreak()); } btnDeploy.IsEnabled = true; } else MessageBox.Show("Invalid file path"); }
private static void Launch(string xapFile) { Xap xap = new Xap(xapFile); Launch(xap.Guid); }
private static RemoteApplicationEx GetApp(string xapFile) { Xap xap = new Xap(xapFile); return GetApp(xap.Guid); }
private static void UnInstall(string xapFile) { Xap xap = new Xap(xapFile); UnInstall(xap.Guid); }