コード例 #1
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;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
        public PackageManagerControl(
            PackageManagerModel model,
            Configuration.ISettings nugetSettings,
            IVsWindowSearchHostFactory searchFactory,
            IVsShell4 vsShell,
            INuGetUILogger uiLogger = null)
        {
            _uiDispatcher = Dispatcher.CurrentDispatcher;
            _uiLogger     = uiLogger;
            Model         = model;
            Settings      = nugetSettings;
            if (!Model.IsSolution)
            {
                _detailModel = new PackageDetailControlModel(Model.Context.SolutionManager, Model.Context.Projects);
            }
            else
            {
                _detailModel = new PackageSolutionDetailControlModel(
                    Model.Context.SolutionManager,
                    Model.Context.Projects,
                    Model.Context.PackageManagerProviders);
            }

            InitializeComponent();

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

            AddRestoreBar();

            AddRestartRequestBar(vsShell);

            AddPackagesErrorBar();

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

            SetTitle();

            _topPanel.IsSolution = Model.IsSolution;
            var settings = LoadSettings();

            InitializeFilterList(settings);
            InitSourceRepoList(settings);
            ApplySettings(settings, nugetSettings);
            _initialized = true;

            // UI is initialized. Start the first search
            _packageList.CheckBoxesEnabled = _topPanel.Filter == ItemFilter.UpdatesAvailable;
            _packageList.IsSolution        = this.Model.IsSolution;

            Loaded += (_, __) =>
            {
                SearchPackagesAndRefreshUpdateCount(_windowSearchHost.SearchQuery.SearchString, useCache: false);
                RefreshConsolidatablePackagesCount();
            };

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

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

            var solutionManager = Model.Context.SolutionManager;

            solutionManager.NuGetProjectAdded      += SolutionManager_ProjectsChanged;
            solutionManager.NuGetProjectRemoved    += SolutionManager_ProjectsChanged;
            solutionManager.NuGetProjectUpdated    += SolutionManager_ProjectsUpdated;
            solutionManager.NuGetProjectRenamed    += SolutionManager_ProjectRenamed;
            solutionManager.ActionsExecuted        += SolutionManager_ActionsExecuted;
            solutionManager.AfterNuGetCacheUpdated += SolutionManager_CacheUpdated;

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

            if (IsUILegalDisclaimerSuppressed())
            {
                _legalDisclaimer.Visibility = Visibility.Collapsed;
            }

            _missingPackageStatus = false;
        }