protected override void Run() { try { ProgressMonitorStatusMessage message = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage(); var action = new RestoreNuGetPackagesAction(GetSelectedSolution()); PackageManagementServices.BackgroundPackageActionRunner.Run(message, action); } catch (Exception ex) { ShowStatusBarError(ex); } }
static void RestorePackages(Solution solution, Action <RestoreNuGetPackagesAction> modifyRestoreAction) { Runtime.AssertMainThread(); try { ProgressMonitorStatusMessage message = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage(); var action = new RestoreNuGetPackagesAction(solution); modifyRestoreAction(action); PackageManagementServices.BackgroundPackageActionRunner.Run(message, action); } catch (Exception ex) { ShowStatusBarError(ex); } }
async Task RestoreAndCheckForUpdates(Solution solution) { bool checkUpdatesAfterRestore = ShouldCheckForUpdates && AnyProjectHasPackages(solution); var action = new RestoreAndCheckForUpdatesAction(solution) { CheckForUpdatesAfterRestore = checkUpdatesAfterRestore }; bool packagesToRestore = await action.HasMissingPackages(); if (packagesToRestore) { ProgressMonitorStatusMessage message = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage(); PackageManagementServices.BackgroundPackageActionRunner.Run(message, action); } else if (checkUpdatesAfterRestore) { CheckForUpdates(solution); } }
static void ShowStatusBarError(Exception ex) { ProgressMonitorStatusMessage message = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage(); PackageManagementServices.BackgroundPackageActionRunner.ShowError(message, ex); }