コード例 #1
0
        private INuGetUIContext CreateUIContext(params NuGetProject[] projects)
        {
            var packageManager = new NuGetPackageManager(
                SourceRepositoryProvider.Value,
                Settings.Value,
                SolutionManager,
                DeleteOnRestartManager.Value);

            var actionEngine = new UIActionEngine(
                SourceRepositoryProvider.Value,
                packageManager,
                LockService.Value);

            // only pick up at most three integrated package managers
            const int MaxPackageManager       = 3;
            var       packageManagerProviders = PackageManagerProviderUtility.Sort(
                PackageManagerProviders, MaxPackageManager);

            var context = new NuGetUIContext(
                SourceRepositoryProvider.Value,
                SolutionManager,
                packageManager,
                actionEngine,
                PackageRestoreManager.Value,
                OptionsPageActivator.Value,
                SolutionUserOptions,
                packageManagerProviders)
            {
                Projects = projects
            };

            return(context);
        }
コード例 #2
0
        public static async Task <NuGetUI> CreateAsync(
            IServiceBroker serviceBroker,
            ICommonOperations commonOperations,
            NuGetUIProjectContext projectContext,
            ISourceRepositoryProvider sourceRepositoryProvider,
            ISettings settings,
            IVsSolutionManager solutionManager,
            IPackageRestoreManager packageRestoreManager,
            IOptionsPageActivator optionsPageActivator,
            IUserSettingsManager userSettingsManager,
            IDeleteOnRestartManager deleteOnRestartManager,
            SolutionUserOptions solutionUserOptions,
            INuGetLockService lockService,
            INuGetUILogger logger,
            IRestoreProgressReporter restoreProgressReporter,
            CancellationToken cancellationToken,
            params IProjectContextInfo[] projects)
        {
            Assumes.NotNull(serviceBroker);
            Assumes.NotNull(commonOperations);
            Assumes.NotNull(projectContext);
            Assumes.NotNull(sourceRepositoryProvider);
            Assumes.NotNull(settings);
            Assumes.NotNull(solutionManager);
            Assumes.NotNull(packageRestoreManager);
            Assumes.NotNull(optionsPageActivator);
            Assumes.NotNull(userSettingsManager);
            Assumes.NotNull(deleteOnRestartManager);
            Assumes.NotNull(solutionUserOptions);
            Assumes.NotNull(lockService);
            Assumes.NotNull(restoreProgressReporter);
            Assumes.NotNull(logger);

            cancellationToken.ThrowIfCancellationRequested();

            var nuGetUi = new NuGetUI(
                commonOperations,
                projectContext,
                logger)
            {
                UIContext = await NuGetUIContext.CreateAsync(
                    serviceBroker,
                    sourceRepositoryProvider,
                    settings,
                    solutionManager,
                    packageRestoreManager,
                    optionsPageActivator,
                    solutionUserOptions,
                    deleteOnRestartManager,
                    lockService,
                    restoreProgressReporter,
                    cancellationToken)
            };

            nuGetUi.UIContext.Projects = projects;

            return(nuGetUi);
        }
コード例 #3
0
 // For testing purposes only.
 internal NuGetUI(
     ICommonOperations commonOperations,
     NuGetUIProjectContext projectContext,
     INuGetUILogger logger,
     NuGetUIContext uiContext)
     : this(commonOperations, projectContext, logger)
 {
     UIContext = uiContext;
 }