コード例 #1
0
        /// <summary>
        /// Returns the UI for the project or given set of projects.
        /// </summary>
        public async ValueTask <INuGetUI> CreateAsync(
            IServiceBroker serviceBroker,
            params IProjectContextInfo[] projects)
        {
            if (serviceBroker is null)
            {
                throw new ArgumentNullException(nameof(serviceBroker));
            }

            var adapterLogger = new LoggerAdapter(ProjectContext);

            ProjectContext.PackageExtractionContext = new PackageExtractionContext(
                PackageSaveMode.Defaultv2,
                PackageExtractionBehavior.XmlDocFileSaveMode,
                ClientPolicyContext.GetClientPolicy(Settings.Value, adapterLogger),
                adapterLogger);

            return(await NuGetUI.CreateAsync(
                       serviceBroker,
                       CommonOperations,
                       ProjectContext,
                       SourceRepositoryProvider.Value,
                       Settings.Value,
                       SolutionManager,
                       PackageRestoreManager.Value,
                       OptionsPageActivator.Value,
                       SolutionUserOptions,
                       DeleteOnRestartManager.Value,
                       SolutionUserOptions,
                       LockService.Value,
                       OutputConsoleLogger,
                       RestoreProgressReporter.Value,
                       CancellationToken.None,
                       projects));
        }
コード例 #2
0
        /// <summary>
        /// Returns the UI for the project or given set of projects.
        /// </summary>
        public async ValueTask <INuGetUI> CreateAsync(params IProjectContextInfo[] projects)
        {
            var adapterLogger = new LoggerAdapter(ProjectContext);

            ProjectContext.PackageExtractionContext = new PackageExtractionContext(
                PackageSaveMode.Defaultv2,
                PackageExtractionBehavior.XmlDocFileSaveMode,
                ClientPolicyContext.GetClientPolicy(Settings.Value, adapterLogger),
                adapterLogger);

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

            return(await NuGetUI.CreateAsync(
                       CommonOperations,
                       ProjectContext,
                       SourceRepositoryProvider.Value,
                       Settings.Value,
                       SolutionManager,
                       PackageRestoreManager.Value,
                       OptionsPageActivator.Value,
                       SolutionUserOptions,
                       DeleteOnRestartManager.Value,
                       packageManagerProviders,
                       SolutionUserOptions,
                       LockService.Value,
                       OutputConsoleLogger,
                       CancellationToken.None,
                       projects));
        }
コード例 #3
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);
        }
コード例 #4
0
        public PackageManagerControl(
            PackageManagerModel model,
            NuGet.Configuration.ISettings nugetSettings,
            IVsWindowSearchHostFactory searchFactory)
        {
            _uiDispatcher = Dispatcher.CurrentDispatcher;
            Model         = model;
            if (Model.Context.Projects.Count() == 1)
            {
                _detailModel = new PackageDetailControlModel(Model.Context.Projects);
            }
            else
            {
                _detailModel = new PackageSolutionDetailControlModel(Model.Context.Projects);
            }

            InitializeComponent();
            SetStyles();

            _windowSearchHostFactory = searchFactory;
            if (_windowSearchHostFactory != null)
            {
                _windowSearchHost = _windowSearchHostFactory.CreateWindowSearchHost(_searchControlParent);
                _windowSearchHost.SetupSearch(this);
                _windowSearchHost.IsVisible = true;
            }

            AddRestoreBar();

            _packageDetail.Control    = this;
            _packageDetail.Visibility = Visibility.Hidden;

            SetTitle();

            var settings = LoadSettings();

            InitializeFilterList(settings);
            InitSourceRepoList(settings);
            ApplySettings(settings, nugetSettings);

            _initialized = true;

            // register with the UI controller
            NuGetUI controller = model.UIController as NuGetUI;

            if (controller != null)
            {
                controller.PackageManagerControl = this;
            }

            Model.Context.SourceProvider.PackageSourceProvider.PackageSourcesSaved += Sources_PackageSourcesChanged;

            if (IsUILegalDisclaimerSuppressed())
            {
                _legalDisclaimer.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
コード例 #5
0
        private void SetOptions(NuGetUI nugetUi, NuGetActionType actionType)
        {
            var options = _detailModel.Options;

            nugetUi.FileConflictAction   = options.SelectedFileConflictAction.Action;
            nugetUi.DependencyBehavior   = options.SelectedDependencyBehavior.Behavior;
            nugetUi.RemoveDependencies   = options.RemoveDependencies;
            nugetUi.ForceRemove          = options.ForceRemove;
            nugetUi.DisplayPreviewWindow = options.ShowPreviewWindow;

            nugetUi.Projects = Model.Context.Projects;
            nugetUi.ProgressWindow.ActionType = actionType;
        }