예제 #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 PRMigratorBar(PackageManagerModel model)
        {
            InitializeComponent();
            _model = model;

            UpgradeMessage.SetResourceReference(TextBlock.ForegroundProperty, VsBrushes.InfoTextKey);
            MigratorBar.SetResourceReference(Border.BackgroundProperty, VsBrushes.InfoBackgroundKey);
            MigratorBar.SetResourceReference(Border.BorderBrushProperty, VsBrushes.ActiveBorderKey);
        }
        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;
            }
        }
        private void CreatePackageManagerControl()
        {
            _container = Initialize();

            this.Title = "NuGet Standalone UI";
            Height = 800;
            Width = 1000;
            
            var repositoryProvider = new SourceRepositoryProvider(_settings, Repository.Provider.GetVisualStudio());
            var settings = new DefaultSettings();

            var testSolutionManager = new TestSolutionManager(@"c:\temp\test");
            
            var projectA = testSolutionManager.AddNewMSBuildProject("projectA");
            var projectB = testSolutionManager.AddNewMSBuildProject("projectB");
            //var projectC = testSolutionManager.AddProjectKProject("projectK");

            var projects = new NuGetProject[] { projectA, projectB };            

            var packageRestoreManager = new PackageRestoreManager(repositoryProvider, settings, testSolutionManager);
            var contextFactory = new StandaloneUIContextFactory(
                repositoryProvider, 
                testSolutionManager, 
                settings, 
                packageRestoreManager: packageRestoreManager,
                optionsPage: null);
            var context = contextFactory.Create(@"c:\temp\test\settings.txt", projects);
            var uiController = _uiServiceFactory.Create(
                context,
                new NuGetUIProjectContext(new StandaloneUILogger(_textBox, _scrollViewer), _sourceControlManagerProvider, _commonOperations));

            PackageManagerModel model = new PackageManagerModel(uiController, context);
            model.SolutionName = "test solution";
            _packageManagerControl = new PackageManagerControl(model, _settings);
            layoutGrid.Children.Add(_packageManagerControl);
        }
예제 #5
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;
        }
예제 #6
0
 public PackageManagerControl(PackageManagerModel model, NuGet.Configuration.ISettings nugetSettings)
     : this(model, nugetSettings, new SimpleSearchBoxFactory())
 {
 }
 public PackageManagerControl(PackageManagerModel model, NuGet.Configuration.ISettings nugetSettings)
     : this(model, nugetSettings, new SimpleSearchBoxFactory())
 {
 }