コード例 #1
0
        static ProgressMonitorStatusMessage GetProgressMonitorUpdateMessages(List <IPackageAction> packageActions)
        {
            int count = packageActions.Count;

            if (count == 1)
            {
                if (packageActions [0] is UpdateMultipleNuGetPackagesAction updateMultiplePackagesAction)
                {
                    count = updateMultiplePackagesAction.PackagesToUpdate.Count();
                    if (count == 1)
                    {
                        return(ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(
                                   updateMultiplePackagesAction.PackagesToUpdate.First().Id));
                    }
                }
                else
                {
                    string packageId = packageActions.Cast <INuGetPackageAction> ().First().PackageId;
                    return(ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageId));
                }
            }

            return(new ProgressMonitorStatusMessage(
                       GettextCatalog.GetString("Updating {0} packages...", count),
                       GettextCatalog.GetString("{0} packages successfully updated.", count),
                       GettextCatalog.GetString("Could not update packages."),
                       GettextCatalog.GetString("{0} packages updated with warnings.", count)
                       ));
        }
コード例 #2
0
        public override void Run(Solution solution, IList <PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
        {
            List <InstallPackageAction>  installPackageActions = CreateInstallPackageActions(solution, packageReferencesForCreatedProjects);
            ProgressMonitorStatusMessage progressMessage       = ProgressMonitorStatusMessageFactory.CreateInstallingProjectTemplatePackagesMessage();

            backgroundPackageActionRunner.Run(progressMessage, installPackageActions);
        }
コード例 #3
0
        void RestorePackages(IEnumerable <DotNetProject> projects)
        {
            var actions = projects.Select(project => new RestoreNuGetPackagesInDotNetCoreProject(project)).ToList();
            var message = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInProjectMessage();

            PackageManagementServices.BackgroundPackageActionRunner.Run(message, actions);
        }
コード例 #4
0
 ProgressMonitorStatusMessage GetProgressMonitorStatusMessages(List <INuGetPackageAction> packageActions)
 {
     if (packageActions.Count == 1)
     {
         string packageId = packageActions.OfType <INuGetPackageAction> ().First().PackageId;
         return(ProgressMonitorStatusMessageFactory.CreateInstallingSinglePackageMessage(packageId));
     }
     return(ProgressMonitorStatusMessageFactory.CreateInstallingMultiplePackagesMessage(packageActions.Count));
 }
コード例 #5
0
        public CheckForUpdatesProgressMonitor(
            IPackageManagementProgressMonitorFactory progressMonitorFactory,
            IPackageManagementEvents packageEvents)
        {
            progressMessage      = ProgressMonitorStatusMessageFactory.CreateCheckingForPackageUpdatesMessage();
            this.progressMonitor = progressMonitorFactory.CreateProgressMonitor(progressMessage.Status);

            eventMonitor = new PackageUpdatesEventMonitor(progressMonitor, packageEvents);
        }
コード例 #6
0
        void Restore(PackageRestorer restorer, Action afterRestore)
        {
            ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesBeforeUpdateMessage();

            PackageManagementBackgroundDispatcher.Dispatch(() => {
                restorer.Restore(progressMessage);
                if (!restorer.RestoreFailed)
                {
                    afterRestore();
                }
            });
        }
コード例 #7
0
 ProgressMonitorStatusMessage GetProgressMonitorStatusMessages(List <IPackageAction> packageActions)
 {
     if (packageActions.Count == 1)
     {
         string packageId = packageActions.OfType <ProcessPackageAction> ().First().Package.Id;
         if (OlderPackageInstalledThanPackageSelected())
         {
             return(ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageId));
         }
         return(ProgressMonitorStatusMessageFactory.CreateInstallingSinglePackageMessage(packageId));
     }
     return(ProgressMonitorStatusMessageFactory.CreateInstallingMultiplePackagesMessage(packageActions.Count));
 }
コード例 #8
0
        public override void Run(Solution solution, IList <PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
        {
            List <IPackageAction> installPackageActions = CreatePackageActions(solution, packageReferencesForCreatedProjects);

            if (!installPackageActions.Any())
            {
                return;
            }

            ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateInstallingProjectTemplatePackagesMessage();

            PackageManagementMSBuildExtension.PackageRestoreTask =
                backgroundPackageActionRunner.RunAsync(progressMessage, installPackageActions);
        }
コード例 #9
0
        public void Run()
        {
            ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage();
            IProgressMonitor             progressMonitor = CreateProgressMonitor(progressMessage);

            try {
                RestorePackages(progressMonitor, progressMessage);
            } catch (Exception ex) {
                LoggingService.LogInternalError(ex);
                progressMonitor.Log.WriteLine(ex.Message);
                progressMonitor.ReportError(progressMessage.Error, null);
                progressMonitor.ShowPackageConsole();
                progressMonitor.Dispose();
            }
        }
コード例 #10
0
        static ProgressMonitorStatusMessage GetProgressMonitorUpdateMessages(List <IPackageAction> packageActions)
        {
            int count = packageActions.Count;

            if (count == 1)
            {
                string packageId = packageActions.OfType <INuGetPackageAction> ().First().PackageId;
                return(ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageId));
            }

            return(new ProgressMonitorStatusMessage(
                       GettextCatalog.GetString("Updating {0} packages...", count),
                       GettextCatalog.GetString("{0} packages successfully updated.", count),
                       GettextCatalog.GetString("Could not update packages."),
                       GettextCatalog.GetString("{0} packages updated with warnings.", count)
                       ));
        }
コード例 #11
0
        static ProgressMonitorStatusMessage GetProgressMonitorUninstallMessages(List <IPackageAction> packageActions)
        {
            int count = packageActions.Count;

            if (count == 1)
            {
                string packageId = packageActions.Cast <INuGetPackageAction> ().First().PackageId;
                return(ProgressMonitorStatusMessageFactory.CreateRemoveSinglePackageMessage(packageId));
            }

            return(new ProgressMonitorStatusMessage(
                       GettextCatalog.GetString("Removing {0} packages...", count),
                       GettextCatalog.GetString("{0} packages successfully removed.", count),
                       GettextCatalog.GetString("Could not remove packages."),
                       GettextCatalog.GetString("{0} packages removed with warnings.", count)
                       ));
        }
コード例 #12
0
        void CheckForPackageUpdatesWithProgressMonitor()
        {
            ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateCheckingForPackageUpdatesMessage();

            using (IProgressMonitor progressMonitor = CreateProgressMonitor(progressMessage)) {
                try {
                    using (var eventMonitor = new PackageUpdatesEventMonitor(progressMonitor)) {
                        CheckForPackageUpdates(progressMonitor, progressMessage, eventMonitor);
                    }
                } catch (Exception ex) {
                    LoggingService.LogInternalError(ex);
                    progressMonitor.Log.WriteLine(ex.Message);
                    progressMonitor.ReportError(progressMessage.Error, null);
                    progressMonitor.ShowPackageConsole();
                }
            }
        }
コード例 #13
0
 public void Restore()
 {
     Restore(ProgressMonitorStatusMessageFactory.CreateRestoringPackagesInSolutionMessage());
 }
コード例 #14
0
 protected virtual ProgressMonitorStatusMessage CreateCheckingPackageCompatibilityMessage()
 {
     return(ProgressMonitorStatusMessageFactory.CreateCheckingPackageCompatibilityMessage());
 }
コード例 #15
0
        public void Run(PackageReferenceNode packageReferenceNode)
        {
            ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateRetargetingSinglePackageMessage(packageReferenceNode.Id);

            Run(packageReferenceNode, progressMessage);
        }
コード例 #16
0
 ProgressMonitorStatusMessage CreateProgressMessage(string packageId)
 {
     return(ProgressMonitorStatusMessageFactory.CreateInstallingSinglePackageMessage(packageId));
 }
コード例 #17
0
        void ShowStatusBarError(Exception ex)
        {
            ProgressMonitorStatusMessage message = ProgressMonitorStatusMessageFactory.CreateInstallingSinglePackageMessage("");

            PackageManagementServices.BackgroundPackageActionRunner.ShowError(message, ex);
        }