private void DeletePackageButton_Click(object sender, EventArgs e) { try { if ((_presenter != null && _presenter.SelectedItem != null)) { string packageFullName = _presenter.SelectedItem.GetOriginalData().FullName; var progressView = new View.Progress.ProgressWindowView(); var progressPresenter = new Presenter.Progress.ProgressPresenter(progressView); progressPresenter.WindowTitle = "Remove App Package"; progressPresenter.TaskDescription = String.Format("Removing App Package {0}", packageFullName); progressView.Show(); var manager = new Services.Packages.PackageManager(); var asyncTask = manager.RemovePackageAsync(progressPresenter, packageFullName); asyncTask.ContinueWith(task => { _presenter.UpdatePackageList(); }); } } catch (Exception ex) { Logger.Log(ex, "DeletePackageButton_Click"); } }
public async Task OnAddPackageButtonClick() { IsWorking = true; var progressPresenter = new Presenter.Progress.ProgressPresenter((View.Progress.IProgressWindowView) this.View) { WindowTitle = "Add App Package", TaskDescription = String.Format("Adding App Package {0}", View.PathToAppPackage) }; var packageManager = new Services.Packages.PackageManager(); bool success = false; bool isDataValid = false; Uri packageLocation = null; bool skipLicense = false; IEnumerable <Uri> dependencies = null; Uri licensePath = null; Uri customDataPath = null; string packageName = null; try { packageLocation = new Uri(View.PathToAppPackage); skipLicense = (!View.IsLicenseChecked); dependencies = GatherDependencyUrls(); licensePath = (View.IsProvisionedModeChecked && View.IsLicenseChecked) ? new Uri(View.PathToLicense) : null; customDataPath = (View.IsProvisionedModeChecked && View.IsCustomDataChecked) ? new Uri(View.PathToCustomData) : null; isDataValid = true; packageName = View.PackageName; } catch (Exception ex) { isDataValid = false; Logger.Log(Logger.LogSeverity.Error, "A portion of the add package form is invalid"); throw new Exception("A portion of the form is invalid", ex); } try { if (isDataValid && View.IsProvisionedModeChecked) { success = await packageManager.AddProvisionedPackageAsync(packageLocation, packageName, skipLicense, dependencies, licensePath, customDataPath, progressPresenter); Logger.Log(Logger.LogSeverity.Information, "Adding provisioned appx package {0}. Result: ({1})", packageLocation.AbsolutePath, success); } else if (isDataValid) { success = await packageManager.AddPackageAsync(packageLocation, dependencies, progressPresenter); Logger.Log(Logger.LogSeverity.Information, "Adding appx package {0}. Result: ({1})", packageLocation.AbsolutePath, success); } } catch (Exception ex) { Logger.Log(ex, "An exception occured while adding appx package"); } IsWorking = false; }
private async Task InstallAppxPackageAsync(string appPackagePath) { var progressView = new View.Progress.ProgressWindowView(); var progressPresenter = new Presenter.Progress.ProgressPresenter(progressView); progressPresenter.WindowTitle = "Add App Package"; progressPresenter.TaskDescription = String.Format("Adding App Package {0}", appPackagePath); progressView.Show(); var manager = new Services.Packages.PackageManager(); //await manager.AddPackageAsync(progressPresenter, appPackagePath); _presenter.UpdatePackageList(); }