private void EndShowLicensePageForAll(Task <IEnumerable <IPackage> > task) { try { Exception exception = task.Exception; if (task.IsCanceled) { // If the task has been cancelled, simply return return; } else if (task.IsFaulted) { this.ShowError(task.Exception.Flatten().InnerException); } else { var packagesToDisplay = task.Result; foreach (IPackage package in packagesToDisplay) { PackagesToDisplayForUpdateAll.Add(new PackageViewModel(_nuGetModel, package, PackageViewModelAction.Update)); } IsLicensePageVisible = true; OnPropertyChanged("IsUpdatingAll"); OnPropertyChanged("NotUpdatingAll"); } } finally { Loading = false; LoadingMessage = null; } }
private void ShowLicensePageForAll(object ignore) { this.PackageAction = PackageViewModelAction.UpdateAll; PackagesToDisplayForUpdateAll.Clear(); Loading = true; LoadingMessage = Resources.String_PackageInformation; Task <IEnumerable <IPackage> > dependenciesTask = Task.Factory.StartNew <IEnumerable <IPackage> >(() => _nuGetModel.PackageManager.GetPackagesToBeInstalledForUpdateAll(), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); _primaryTask = dependenciesTask.ContinueWith(EndShowLicensePageForAll, this.Scheduler); }