public static void RemoveListener(IHttpClientEvents source, IWeakEventListener listener)
        {
            // weak event pattern cannot be used if we're running from command line.
            Debug.Assert(!EnvironmentUtility.RunningFromCommandLine);

            SendingRequestEventManager.CurrentManager.ProtectedRemoveListener(source, listener);
        }
        public static void RemoveListener(IHttpClientEvents source, IWeakEventListener listener)
        {
            // weak event pattern cannot be used if we're running from command line.
            Debug.Assert(!EnvironmentUtility.RunningFromCommandLine);

            SendingRequestEventManager.CurrentManager.ProtectedRemoveListener(source, listener);
        }
Example #3
0
        internal InstallPackageCommand(
            ISolutionManager solutionManager,
            IVsPackageManagerFactory packageManagerFactory,
            IPackageRepositoryFactory repositoryFactory,
            IVsPackageSourceProvider packageSourceProvider,
            IHttpClientEvents httpClientEvents,
            IProductUpdateService productUpdateService,
            IVsCommonOperations vsCommonOperations,
            IDeleteOnRestartManager deleteOnRestartManager,
            bool networkAvailable)
            : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
        {
            _productUpdateService  = productUpdateService;
            _repositoryFactory     = repositoryFactory;
            _packageSourceProvider = packageSourceProvider;

            if (networkAvailable)
            {
                _isNetworkAvailable = isNetworkAvailable();
            }
            else
            {
                _isNetworkAvailable = false;
            }
        }
        private PackageManagerWindow(Project project,
                                     DTE dte,
                                     IVsPackageManagerFactory packageManagerFactory,
                                     IPackageRepositoryFactory repositoryFactory,
                                     IPackageSourceProvider packageSourceProvider,
                                     IHttpClientEvents httpClientEvents,
                                     IProductUpdateService productUpdateService,
                                     IPackageRestoreManager packageRestoreManager,
                                     ISolutionManager solutionManager,
                                     IOptionsPageActivator optionPageActivator,
                                     IDeleteOnRestartManager deleteOnRestartManager,
                                     IVsShell4 vsRestarter,
                                     string dialogParameters)
            : base(F1Keyword)
        {
            InitializeComponent();

#if !VS10
            // set unique search guid for VS11
            explorer.SearchCategory = new Guid("{85566D5F-E585-411F-B299-5BF006E9F11E}");
#endif

            _httpClientEvents = httpClientEvents;
            if (_httpClientEvents != null)
            {
                _httpClientEvents.SendingRequest += OnSendingRequest;
            }

            _productUpdateService = productUpdateService;
            _optionsPageActivator = optionPageActivator;
            _activeProject        = project;

            // replace the ConsoleOutputProvider with SmartOutputConsoleProvider so that we can clear
            // the console the first time an entry is written to it
            var providerServices = new ProviderServices();
            _smartOutputConsoleProvider            = new SmartOutputConsoleProvider(providerServices.OutputConsoleProvider);
            providerServices.OutputConsoleProvider = _smartOutputConsoleProvider;
            _providerSettings = providerServices.ProviderSettings;

            AddUpdateBar(productUpdateService);
            AddRestoreBar(packageRestoreManager);
            var restartRequestBar = AddRestartRequestBar(deleteOnRestartManager, vsRestarter);
            InsertDisclaimerElement();
            AdjustSortComboBoxWidth();
            PreparePrereleaseComboBox();

            SetupProviders(
                project,
                dte,
                packageManagerFactory,
                repositoryFactory,
                packageSourceProvider,
                providerServices,
                httpClientEvents,
                solutionManager,
                packageRestoreManager,
                restartRequestBar);

            ProcessDialogParameters(dialogParameters);
        }
 void RegisterHttpClient(IHttpClientEvents clientEvents)
 {
     if (clientEvents != null)
     {
         clientEvents.SendingRequest += SendingRequest;
     }
 }
Example #6
0
        internal InstallPackageCommand(
            ISolutionManager solutionManager,
            IVsPackageManagerFactory packageManagerFactory,
            IPackageRepositoryFactory repositoryFactory,
            IVsPackageSourceProvider packageSourceProvider,
            IHttpClientEvents httpClientEvents,
            IProductUpdateService productUpdateService,
            IVsCommonOperations vsCommonOperations,
            IDeleteOnRestartManager deleteOnRestartManager,
            bool networkAvailable)
            : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
        {
            _productUpdateService = productUpdateService;
            _repositoryFactory = repositoryFactory;
            _packageSourceProvider = packageSourceProvider;
            DependencyVersion = DependencyVersion.Lowest;

            if (networkAvailable)
            {
                _isNetworkAvailable = isNetworkAvailable();
            }
            else
            {
                _isNetworkAvailable = false;
            }
        }
        public GetPackageCommand(IPackageRepositoryFactory repositoryFactory,
                                IVsPackageSourceProvider packageSourceProvider,
                                ISolutionManager solutionManager,
                                IVsPackageManagerFactory packageManagerFactory,
                                IPackageRepository recentPackagesRepository,
                                IHttpClientEvents httpClientEvents,
                                IProductUpdateService productUpdateService)
            : base(solutionManager, packageManagerFactory, httpClientEvents)
        {

            if (repositoryFactory == null)
            {
                throw new ArgumentNullException("repositoryFactory");
            }
            if (packageSourceProvider == null)
            {
                throw new ArgumentNullException("packageSourceProvider");
            }
            if (recentPackagesRepository == null)
            {
                throw new ArgumentNullException("recentPackagesRepository");
            }

            _repositoryFactory = repositoryFactory;
            _packageSourceProvider = packageSourceProvider;
            _recentPackagesRepository = recentPackagesRepository;
            _productUpdateService = productUpdateService;
        }
Example #8
0
        public GetPackageCommand(IPackageRepositoryFactory repositoryFactory,
                                 IVsPackageSourceProvider packageSourceProvider,
                                 ISolutionManager solutionManager,
                                 IVsPackageManagerFactory packageManagerFactory,
                                 IPackageRepository recentPackagesRepository,
                                 IHttpClientEvents httpClientEvents,
                                 IProductUpdateService productUpdateService)
            : base(solutionManager, packageManagerFactory, httpClientEvents)
        {
            if (repositoryFactory == null)
            {
                throw new ArgumentNullException("repositoryFactory");
            }
            if (packageSourceProvider == null)
            {
                throw new ArgumentNullException("packageSourceProvider");
            }
            if (recentPackagesRepository == null)
            {
                throw new ArgumentNullException("recentPackagesRepository");
            }

            _repositoryFactory        = repositoryFactory;
            _packageSourceProvider    = packageSourceProvider;
            _recentPackagesRepository = recentPackagesRepository;
            _productUpdateService     = productUpdateService;
        }
 public UninstallPackageCommand(ISolutionManager solutionManager,
                                IVsPackageManagerFactory packageManagerFactory,
                                IHttpClientEvents httpClientEvents,
                                IVsCommonOperations vsCommonOperations,
                                IDeleteOnRestartManager deleteOnRestartManager)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
 {
 }
 public UninstallPackageCommand(ISolutionManager solutionManager,
                                IVsPackageManagerFactory packageManagerFactory,
                                IHttpClientEvents httpClientEvents,
                                IVsCommonOperations vsCommonOperations,
                                IDeleteOnRestartManager deleteOnRestartManager)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
 {
 }
 public FindPackageCommand(IPackageRepositoryFactory repositoryFactory,
                           IVsPackageSourceProvider packageSourceProvider,
                           ISolutionManager solutionManager,
                           IVsPackageManagerFactory packageManagerFactory,
                           IHttpClientEvents httpClientEvents)
     : base(repositoryFactory, packageSourceProvider, solutionManager, packageManagerFactory, httpClientEvents, null)
 {
 }
Example #12
0
 public UpdatePackageCommand(ISolutionManager solutionManager,
                             IVsPackageManagerFactory packageManagerFactory,
                             IHttpClientEvents httpClientEvents,
                             IProductUpdateService productUpdateService)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
     _productUpdateService = productUpdateService;
 }
Example #13
0
 public UpdatePackageCommand(ISolutionManager solutionManager, 
     IVsPackageManagerFactory packageManagerFactory,
     IHttpClientEvents httpClientEvents,
     IProductUpdateService productUpdateService)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
     _productUpdateService = productUpdateService;
 }
 public GetRemotePackageIdCommand(
     ISolutionManager solutionManager,
     IVsPackageManagerFactory packageManagerFactory,
     IHttpClientEvents httpClientEvents,
     IPackageRepositoryFactory repositoryFactory,
     IVsPackageSourceProvider packageSourceProvider)
     : base(solutionManager, packageManagerFactory, httpClientEvents, repositoryFactory, packageSourceProvider)
 {
 }
        public FindPackageCommand(IPackageRepositoryFactory repositoryFactory,
                          IVsPackageSourceProvider packageSourceProvider,
                          ISolutionManager solutionManager,
                          IVsPackageManagerFactory packageManagerFactory,
                          IHttpClientEvents httpClientEvents)
            : base(repositoryFactory, packageSourceProvider, solutionManager, packageManagerFactory, httpClientEvents, null)
        {

        }
        private PackageManagerWindow(Project project,
                                    DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory repositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    IRecentPackageRepository recentPackagesRepository,
                                    IHttpClientEvents httpClientEvents,
                                    IProductUpdateService productUpdateService,
                                    IPackageRestoreManager packageRestoreManager,
                                    ISolutionManager solutionManager,
                                    IOptionsPageActivator optionPageActivator)
            : base(F1Keyword)
        {

            InitializeComponent();

#if !VS10
            // set unique search guid for VS11
            explorer.SearchCategory = new Guid("{85566D5F-E585-411F-B299-5BF006E9F11E}");
#endif

            _httpClientEvents = httpClientEvents;
            if (_httpClientEvents != null)
            {
                _httpClientEvents.SendingRequest += OnSendingRequest;
            }

            _productUpdateService = productUpdateService;
            _optionsPageActivator = optionPageActivator;
            _activeProject = project;

            // replace the ConsoleOutputProvider with SmartOutputConsoleProvider so that we can clear 
            // the console the first time an entry is written to it
            var providerServices = new ProviderServices();
            _smartOutputConsoleProvider = new SmartOutputConsoleProvider(providerServices.OutputConsoleProvider);
            providerServices.OutputConsoleProvider = _smartOutputConsoleProvider;
            _providerSettings = providerServices.ProviderSettings;

            AddUpdateBar(productUpdateService);
            AddRestoreBar(packageRestoreManager);
            InsertDisclaimerElement();
            AdjustSortComboBoxWidth();
            PreparePrereleaseComboBox();

            SetupProviders(
                project,
                dte,
                packageManagerFactory,
                repositoryFactory,
                packageSourceProvider,
                providerServices,
                recentPackagesRepository,
                httpClientEvents,
                solutionManager,
                packageRestoreManager);
        }
 protected ProcessPackageBaseCommand(
     ISolutionManager solutionManager, 
     IVsPackageManagerFactory packageManagerFactory, 
     IHttpClientEvents httpClientEvents,
     IVsCommonOperations vsCommonOperations)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
     Debug.Assert(vsCommonOperations != null);
     _vsCommonOperations = vsCommonOperations;
 }
 protected ProcessPackageBaseCommand(
     ISolutionManager solutionManager,
     IVsPackageManagerFactory packageManagerFactory,
     IHttpClientEvents httpClientEvents,
     IVsCommonOperations vsCommonOperations)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
     Debug.Assert(vsCommonOperations != null);
     _vsCommonOperations = vsCommonOperations;
 }
 public PackageInstallBaseCommand(
     IVsPackageSourceProvider packageSourceProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     SVsServiceProvider svcServiceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ISolutionManager solutionManager,
     IHttpClientEvents clientEvents)
     : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents, PackageActionType.Install)
 {
     this.PackageSourceProvider = packageSourceProvider;
 }
 public AddBindingRedirectCommand(
     ISolutionManager solutionManager, 
     IHttpClientEvents httpClientEvents, 
     IFileSystemProvider fileSystemProvider,
     IVsFrameworkMultiTargeting frameworkMultiTargeting)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
     _fileSystemProvider = fileSystemProvider;
     _frameworkMultiTargeting = frameworkMultiTargeting;
 }
Example #21
0
 public PackageInstallBaseCommand(
     IVsPackageSourceProvider packageSourceProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     SVsServiceProvider svcServiceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ISolutionManager solutionManager,
     IHttpClientEvents clientEvents)
     : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents, PackageActionType.Install)
 {
     this.PackageSourceProvider = packageSourceProvider;
 }
Example #22
0
 protected JsonApiCommandBase(
     ISolutionManager solutionManager,
     IVsPackageManagerFactory packageManagerFactory,
     IHttpClientEvents httpClientEvents,
     IPackageRepositoryFactory repositoryFactory,
     IVsPackageSourceProvider packageSourceProvider)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
     _repositoryFactory     = repositoryFactory;
     _packageSourceProvider = packageSourceProvider;
 }
 public AddBindingRedirectCommand(
     ISolutionManager solutionManager,
     IHttpClientEvents httpClientEvents,
     IFileSystemProvider fileSystemProvider,
     IVsFrameworkMultiTargeting frameworkMultiTargeting)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager         = solutionManager;
     _fileSystemProvider      = fileSystemProvider;
     _frameworkMultiTargeting = frameworkMultiTargeting;
 }
		WebRequest FireSendingRequestEvent(IHttpClientEvents clientEvents)
		{
			WebRequest request = CreateWebRequest();
			request.Headers = new WebHeaderCollection();
			
			var eventArgs = new WebRequestEventArgs(request);
			clientEvents.Raise(
				events => events.SendingRequest += null,
				clientEvents,
				eventArgs);
			
			return request;
		}
        public void SendingRequest_UserAgentGeneration_UserAgentSetOnRequest()
        {
            CreateGenerator();
            IHttpClientEvents clientEvents = CreatePackageRepositoryThatImplementsIHttpClientEvents();

            FireRepositoryCreatedEvent(clientEvents);

            WebRequest request = FireSendingRequestEvent(clientEvents);

            string userAgent = request.Headers[HttpRequestHeader.UserAgent];

            Assert.IsTrue(userAgent.StartsWith("SharpDevelop"), userAgent);
        }
Example #26
0
 public UpdatePackageCommand(ISolutionManager solutionManager,
                             IVsPackageManagerFactory packageManagerFactory,
                             IPackageRepositoryFactory repositoryFactory,
                             IVsPackageSourceProvider packageSourceProvider,
                             IHttpClientEvents httpClientEvents,
                             IProductUpdateService productUpdateService,
                             IVsCommonOperations vsCommonOperations)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations)
 {
     _repositoryFactory     = repositoryFactory;
     _packageSourceProvider = packageSourceProvider;
     _productUpdateService  = productUpdateService;
 }
Example #27
0
 public UpdatePackageCommand(ISolutionManager solutionManager,
                             IVsPackageManagerFactory packageManagerFactory,
                             IPackageRepositoryFactory repositoryFactory,
                             IVsPackageSourceProvider packageSourceProvider,
                             IHttpClientEvents httpClientEvents,
                             IProductUpdateService productUpdateService,
                             IVsCommonOperations vsCommonOperations)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations)
 {
     _repositoryFactory = repositoryFactory;
     _packageSourceProvider = packageSourceProvider;
     _productUpdateService = productUpdateService;
 }
 public PackageActionBaseCommand(
     IVsPackageSourceProvider packageSourceProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     SVsServiceProvider svcServiceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ISolutionManager solutionManager,
     IHttpClientEvents clientEvents,
     PackageActionType actionType)
     : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents)
 {
     _actionType             = actionType;
     _vsCommonOperations     = ServiceLocator.GetInstance <IVsCommonOperations>();
     _deleteOnRestartManager = ServiceLocator.GetInstance <IDeleteOnRestartManager>();
 }
 public PackageActionBaseCommand(
     IVsPackageSourceProvider packageSourceProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     SVsServiceProvider svcServiceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ISolutionManager solutionManager,
     IHttpClientEvents clientEvents,
     PackageActionType actionType)
     : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents)
 {
     _actionType = actionType;
     _vsCommonOperations = ServiceLocator.GetInstance<IVsCommonOperations>();
     _deleteOnRestartManager = ServiceLocator.GetInstance<IDeleteOnRestartManager>();
 }
Example #30
0
 public InstallPackageCommand(
     ISolutionManager solutionManager,
     IVsPackageManagerFactory packageManagerFactory,
     IPackageRepositoryFactory repositoryFactory,
     IVsPackageSourceProvider packageSourceProvider,
     IHttpClientEvents httpClientEvents,
     IProductUpdateService productUpdateService,
     IVsCommonOperations vsCommonOperations,
     IDeleteOnRestartManager deleteOnRestartManager)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
 {
     _productUpdateService = productUpdateService;
     _repositoryFactory = repositoryFactory;
     _packageSourceProvider = packageSourceProvider;
 }
Example #31
0
 public InstallPackageCommand(
     ISolutionManager solutionManager,
     IVsPackageManagerFactory packageManagerFactory,
     IPackageRepositoryFactory repositoryFactory,
     IVsPackageSourceProvider packageSourceProvider,
     IHttpClientEvents httpClientEvents,
     IProductUpdateService productUpdateService,
     IVsCommonOperations vsCommonOperations,
     IDeleteOnRestartManager deleteOnRestartManager)
     : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager)
 {
     _productUpdateService  = productUpdateService;
     _repositoryFactory     = repositoryFactory;
     _packageSourceProvider = packageSourceProvider;
 }
        WebRequest FireSendingRequestEvent(IHttpClientEvents clientEvents)
        {
            WebRequest request = CreateWebRequest();

            request.Headers = new WebHeaderCollection();

            var eventArgs = new WebRequestEventArgs(request);

            clientEvents.Raise(
                events => events.SendingRequest += null,
                clientEvents,
                eventArgs);

            return(request);
        }
Example #33
0
        public PackageManagerWindow(DTE dte,
                                    IVsUIShell vsUIShell,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory repositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    ProviderServices providerServices,
                                    IRecentPackageRepository recentPackagesRepository,
                                    IHttpClientEvents httpClientEvents,
                                    ISelectedProviderSettings selectedProviderSettings,
                                    IProductUpdateService productUpdateService)
            : base(F1Keyword)
        {
            InitializeComponent();

            _httpClientEvents = httpClientEvents;
            if (_httpClientEvents != null)
            {
                _httpClientEvents.SendingRequest += OnSendingRequest;
            }

            AddUpdateBar(productUpdateService);

            _vsUIShell = vsUIShell;
            _selectedProviderSettings = selectedProviderSettings;
            _productUpdateService     = productUpdateService;

            InsertDisclaimerElement();
            AdjustSortComboBoxWidth();

            // replace the ConsoleOutputProvider with SmartOutputConsoleProvider so that we can clear
            // the console the first time an entry is written to it
            _smartOutputConsoleProvider = new SmartOutputConsoleProvider(providerServices.OutputConsoleProvider);
            providerServices            = new ProviderServices(
                providerServices.LicenseWindow,
                providerServices.ProgressWindow,
                providerServices.ScriptExecutor,
                _smartOutputConsoleProvider);

            SetupProviders(
                dte,
                packageManagerFactory,
                repositoryFactory,
                packageSourceProvider,
                providerServices,
                recentPackagesRepository,
                httpClientEvents);
        }
Example #34
0
 public NuGetPowerShellBaseCommand(
     IVsPackageSourceProvider packageSourceProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     SVsServiceProvider svcServceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ISolutionManager solutionManager,
     IHttpClientEvents clientEvents)
 {
     _packageSourceProvider = packageSourceProvider;
     _repositoryFactory     = packageRepositoryFactory;
     _serviceProvider       = svcServceProvider;
     _packageManagerFactory = packageManagerFactory;
     _solutionManager       = solutionManager;
     _repoManager           = new VsSourceRepositoryManager(_packageSourceProvider, _repositoryFactory);
     _VsContext             = new VsPackageManagerContext(_repoManager, _serviceProvider, _solutionManager, _packageManagerFactory);
     _httpClientEvents      = clientEvents;
 }
        public PackageManagerWindow(DTE dte,
            IVsUIShell vsUIShell,
            IVsPackageManagerFactory packageManagerFactory,
            IPackageRepositoryFactory repositoryFactory,
            IPackageSourceProvider packageSourceProvider,
            ProviderServices providerServices,
            IRecentPackageRepository recentPackagesRepository,
            IHttpClientEvents httpClientEvents,
            ISelectedProviderSettings selectedProviderSettings,
            IProductUpdateService productUpdateService)
            : base(F1Keyword)
        {
            InitializeComponent();

            _httpClientEvents = httpClientEvents;
            if (_httpClientEvents != null) {
                _httpClientEvents.SendingRequest += OnSendingRequest;
            }

            AddUpdateBar(productUpdateService);

            _vsUIShell = vsUIShell;
            _selectedProviderSettings = selectedProviderSettings;
            _productUpdateService = productUpdateService;

            InsertDisclaimerElement();
            AdjustSortComboBoxWidth();

            // replace the ConsoleOutputProvider with SmartOutputConsoleProvider so that we can clear
            // the console the first time an entry is written to it
            _smartOutputConsoleProvider = new SmartOutputConsoleProvider(providerServices.OutputConsoleProvider);
            providerServices = new ProviderServices(
                providerServices.LicenseWindow,
                providerServices.ProgressWindow,
                providerServices.ScriptExecutor,
                _smartOutputConsoleProvider);

            SetupProviders(
                dte,
                packageManagerFactory,
                repositoryFactory,
                packageSourceProvider,
                providerServices,
                recentPackagesRepository,
                httpClientEvents);
        }
Example #36
0
 public static void RemoveListener(IHttpClientEvents source, IWeakEventListener listener)
 {
     SendingRequestEventManager.CurrentManager.ProtectedRemoveListener(source, listener);
 }
Example #37
0
 public AddBindingRedirectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
 }
Example #38
0
 public UninstallPackageCommand(ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IHttpClientEvents httpClientEvents)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
 }
Example #39
0
 protected ProcessPackageBaseCommand(ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IHttpClientEvents httpClientEvents)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
 }
Example #40
0
 public GetProjectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
 }
        private void SetupProviders(Project activeProject,
                                    DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory packageRepositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    ProviderServices providerServices,
                                    IHttpClientEvents httpClientEvents,
                                    ISolutionManager solutionManager,
                                    IPackageRestoreManager packageRestoreManager,
                                    RestartRequestBar restartRequestBar)
        {
            IVsPackageManager packageManager = packageManagerFactory.CreatePackageManagerToManageInstalledPackages();

            IPackageRepository localRepository;

            // we need different sets of providers depending on whether the dialog is open for solution or a project
            OnlineProvider onlineProvider;
            InstalledProvider installedProvider;
            UpdatesProvider updatesProvider;

            if (activeProject == null)
            {
                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    dte.Solution.GetName() + ".sln");

                localRepository = packageManager.LocalRepository;

                onlineProvider = new SolutionOnlineProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new SolutionInstalledProvider(
                    packageManager,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new SolutionUpdatesProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }
            else
            {
                IProjectManager projectManager = packageManager.GetProjectManager(activeProject);
                localRepository = projectManager.LocalRepository;

                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    activeProject.GetDisplayName());

                onlineProvider = new OnlineProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new InstalledProvider(
                    packageManager,
                    activeProject,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new UpdatesProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }

            explorer.Providers.Add(installedProvider);
            explorer.Providers.Add(onlineProvider);
            explorer.Providers.Add(updatesProvider);

            installedProvider.IncludePrerelease =
                onlineProvider.IncludePrerelease =
                updatesProvider.IncludePrerelease = _providerSettings.IncludePrereleasePackages;

            installedProvider.ExecuteCompletedCallback =
                onlineProvider.ExecuteCompletedCallback =
                updatesProvider.ExecuteCompletedCallback = restartRequestBar.CheckForUnsuccessfulUninstall;

            Loaded += (o, e) => restartRequestBar.CheckForUnsuccessfulUninstall();
        }
 public AddBindingRedirectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
 }
 void FireRepositoryCreatedEvent(IHttpClientEvents clientEvents)
 {
     FireRepositoryCreatedEvent(clientEvents as IPackageRepository);
 }
 public UninstallPackageCommand(ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IHttpClientEvents httpClientEvents)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
 }
        private void SetupProviders(DTE dte,
            IVsPackageManagerFactory packageManagerFactory,
            IPackageRepositoryFactory packageRepositoryFactory,
            IPackageSourceProvider packageSourceProvider,
            ProviderServices providerServices,
            IPackageRepository recentPackagesRepository,
            IHttpClientEvents httpClientEvents)
        {
            IVsPackageManager packageManager = packageManagerFactory.CreatePackageManager();
            Project activeProject = dte.GetActiveProject();

            // Create a cached project manager so that checking for installed packages is fast
            IProjectManager projectManager = packageManager.GetProjectManager(activeProject);

            var recentProvider = new RecentProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageManagerFactory,
                recentPackagesRepository,
                packageSourceProvider,
                providerServices,
                httpClientEvents);

            var updatesProvider = new UpdatesProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageSourceProvider,
                packageManagerFactory,
                providerServices,
                httpClientEvents);

            var onlineProvider = new OnlineProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageSourceProvider,
                packageManagerFactory,
                providerServices,
                httpClientEvents);

            var installedProvider = new InstalledProvider(
                packageManager,
                activeProject,
                projectManager,
                Resources,
                providerServices,
                httpClientEvents);

            explorer.Providers.Add(installedProvider);
            explorer.Providers.Add(onlineProvider);
            explorer.Providers.Add(updatesProvider);
            explorer.Providers.Add(recentProvider);

            // retrieve the selected provider from the settings
            int selectedProvider = Math.Min(3, _selectedProviderSettings.SelectedProvider);
            explorer.SelectedProvider = explorer.Providers[selectedProvider];
        }
Example #46
0
 public static void AddListener(IHttpClientEvents source, IWeakEventListener listener)
 {
     CurrentManager.ProtectedAddListener(source, listener);
 }
 public static void RemoveListener(IHttpClientEvents source, IWeakEventListener listener)
 {
     SendingRequestEventManager.CurrentManager.ProtectedRemoveListener(source, listener);
 }
 public AnalyzeCmdlet(ISolutionManager solutionManager, IVsPackageManagerFactory vsPackageManagerFactory, IHttpClientEvents httpClientEvents) 
     : base(solutionManager, vsPackageManagerFactory, httpClientEvents)
 {
 }
 public AddBindingRedirectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents, IFileSystemProvider fileSystemProvider)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
     _fileSystemProvider = fileSystemProvider;
 }
Example #50
0
 public GetProjectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager = solutionManager;
 }
 public AddBindingRedirectCommand(ISolutionManager solutionManager, IHttpClientEvents httpClientEvents, IFileSystemProvider fileSystemProvider)
     : base(solutionManager, null, httpClientEvents)
 {
     _solutionManager    = solutionManager;
     _fileSystemProvider = fileSystemProvider;
 }
        private void SetupProviders(Project activeProject,
                                    DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory packageRepositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    ProviderServices providerServices,
                                    IPackageRepository recentPackagesRepository,
                                    IHttpClientEvents httpClientEvents,
                                    ISolutionManager solutionManager,
                                    IPackageRestoreManager packageRestoreManager)
        {

            // This package manager is not used for installing from a remote source, and therefore does not need a fallback repository for resolving dependencies
            IVsPackageManager packageManager = packageManagerFactory.CreatePackageManager(ServiceLocator.GetInstance<IPackageRepository>(), useFallbackForDependencies: false);

            IPackageRepository localRepository;

            // we need different sets of providers depending on whether the dialog is open for solution or a project
            OnlineProvider onlineProvider;
            InstalledProvider installedProvider;
            UpdatesProvider updatesProvider;
            OnlineProvider recentProvider;

            if (activeProject == null)
            {
                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    dte.Solution.GetName() + ".sln");

                localRepository = packageManager.LocalRepository;

                onlineProvider = new SolutionOnlineProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new SolutionInstalledProvider(
                    packageManager,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new SolutionUpdatesProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                recentProvider = new SolutionRecentProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageManagerFactory,
                    recentPackagesRepository,
                    packageSourceProvider,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }
            else
            {
                IProjectManager projectManager = packageManager.GetProjectManager(activeProject);
                localRepository = projectManager.LocalRepository;

                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    activeProject.GetDisplayName());

                onlineProvider = new OnlineProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new InstalledProvider(
                    packageManager,
                    activeProject,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new UpdatesProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                recentProvider = new RecentProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageManagerFactory,
                    recentPackagesRepository,
                    packageSourceProvider,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }

            explorer.Providers.Add(installedProvider);
            explorer.Providers.Add(onlineProvider);
            explorer.Providers.Add(updatesProvider);
            explorer.Providers.Add(recentProvider);

            installedProvider.IncludePrerelease =
                onlineProvider.IncludePrerelease =
                updatesProvider.IncludePrerelease =
                recentProvider.IncludePrerelease = _providerSettings.IncludePrereleasePackages;

            // retrieve the selected provider from the settings
            int selectedProvider = Math.Min(3, _providerSettings.SelectedProvider);
            explorer.SelectedProvider = explorer.Providers[selectedProvider];
        }
Example #53
0
 protected NuGetBaseCommand(ISolutionManager solutionManager, IVsPackageManagerFactory vsPackageManagerFactory, IHttpClientEvents httpClientEvents)
 {
     _solutionManager         = solutionManager;
     _vsPackageManagerFactory = vsPackageManagerFactory;
     _httpClientEvents        = httpClientEvents;
 }
Example #54
0
        private void SetupProviders(DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory packageRepositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    ProviderServices providerServices,
                                    IPackageRepository recentPackagesRepository,
                                    IHttpClientEvents httpClientEvents)
        {
            IVsPackageManager packageManager = packageManagerFactory.CreatePackageManager();
            Project           activeProject  = dte.GetActiveProject();

            // Create a cached project manager so that checking for installed packages is fast
            IProjectManager projectManager = packageManager.GetProjectManager(activeProject);

            var recentProvider = new RecentProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageManagerFactory,
                recentPackagesRepository,
                packageSourceProvider,
                providerServices,
                httpClientEvents);


            var updatesProvider = new UpdatesProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageSourceProvider,
                packageManagerFactory,
                providerServices,
                httpClientEvents);

            var onlineProvider = new OnlineProvider(
                activeProject,
                projectManager,
                Resources,
                packageRepositoryFactory,
                packageSourceProvider,
                packageManagerFactory,
                providerServices,
                httpClientEvents);

            var installedProvider = new InstalledProvider(
                packageManager,
                activeProject,
                projectManager,
                Resources,
                providerServices,
                httpClientEvents);

            explorer.Providers.Add(installedProvider);
            explorer.Providers.Add(onlineProvider);
            explorer.Providers.Add(updatesProvider);
            explorer.Providers.Add(recentProvider);

            // retrieve the selected provider from the settings
            int selectedProvider = Math.Min(3, _selectedProviderSettings.SelectedProvider);

            explorer.SelectedProvider = explorer.Providers[selectedProvider];
        }
 void RegisterHttpClient(IHttpClientEvents clientEvents)
 {
     if (clientEvents != null) {
         clientEvents.SendingRequest += SendingRequest;
     }
 }
Example #56
0
        private void SetupProviders(Project activeProject,
                                    DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory packageRepositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    ProviderServices providerServices,
                                    IHttpClientEvents httpClientEvents,
                                    ISolutionManager solutionManager,
                                    IPackageRestoreManager packageRestoreManager,
                                    RestartRequestBar restartRequestBar)
        {
            // This package manager is not used for installing from a remote source, and therefore does not need a fallback repository for resolving dependencies
            IVsPackageManager packageManager = packageManagerFactory.CreatePackageManager(ServiceLocator.GetInstance <IPackageRepository>(), useFallbackForDependencies: false);

            IPackageRepository localRepository;

            // we need different sets of providers depending on whether the dialog is open for solution or a project
            OnlineProvider    onlineProvider;
            InstalledProvider installedProvider;
            UpdatesProvider   updatesProvider;

            if (activeProject == null)
            {
                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    dte.Solution.GetName() + ".sln");

                localRepository = packageManager.LocalRepository;

                onlineProvider = new SolutionOnlineProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new SolutionInstalledProvider(
                    packageManager,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new SolutionUpdatesProvider(
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }
            else
            {
                IProjectManager projectManager = packageManager.GetProjectManager(activeProject);
                localRepository = projectManager.LocalRepository;

                Title = String.Format(
                    CultureInfo.CurrentUICulture,
                    NuGet.Dialog.Resources.Dialog_Title,
                    activeProject.GetDisplayName());

                onlineProvider = new OnlineProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);

                installedProvider = new InstalledProvider(
                    packageManager,
                    activeProject,
                    localRepository,
                    Resources,
                    providerServices,
                    httpClientEvents,
                    solutionManager,
                    packageRestoreManager);

                updatesProvider = new UpdatesProvider(
                    activeProject,
                    localRepository,
                    Resources,
                    packageRepositoryFactory,
                    packageSourceProvider,
                    packageManagerFactory,
                    providerServices,
                    httpClientEvents,
                    solutionManager);
            }

            explorer.Providers.Add(installedProvider);
            explorer.Providers.Add(onlineProvider);
            explorer.Providers.Add(updatesProvider);

            installedProvider.IncludePrerelease       =
                onlineProvider.IncludePrerelease      =
                    updatesProvider.IncludePrerelease = _providerSettings.IncludePrereleasePackages;

            installedProvider.ExecuteCompletedCallback       =
                onlineProvider.ExecuteCompletedCallback      =
                    updatesProvider.ExecuteCompletedCallback = restartRequestBar.CheckForUnsuccessfulUninstall;

            Loaded += (o, e) => restartRequestBar.CheckForUnsuccessfulUninstall();
        }
        private PackageManagerWindow(Project project,
                                    DTE dte,
                                    IVsPackageManagerFactory packageManagerFactory,
                                    IPackageRepositoryFactory repositoryFactory,
                                    IPackageSourceProvider packageSourceProvider,
                                    IHttpClientEvents httpClientEvents,
                                    IProductUpdateService productUpdateService,
                                    IPackageRestoreManager packageRestoreManager,
                                    ISolutionManager solutionManager,
                                    IOptionsPageActivator optionPageActivator,
                                    IDeleteOnRestartManager deleteOnRestartManager,
                                    IVsShell4 vsRestarter,
                                    string dialogParameters)
            : base(F1Keyword)
        {

            InitializeComponent();

#if !VS10
            // set unique search guid for VS11
            explorer.SearchCategory = new Guid("{85566D5F-E585-411F-B299-5BF006E9F11E}");
#endif

            _httpClientEvents = httpClientEvents;
            if (_httpClientEvents != null)
            {
                _httpClientEvents.SendingRequest += OnSendingRequest;
            }

            _productUpdateService = productUpdateService;
            _optionsPageActivator = optionPageActivator;
            _activeProject = project;

            // replace the ConsoleOutputProvider with SmartOutputConsoleProvider so that we can clear 
            // the console the first time an entry is written to it
            var providerServices = new ProviderServices();
            _smartOutputConsoleProvider = new SmartOutputConsoleProvider(providerServices.OutputConsoleProvider);
            providerServices.OutputConsoleProvider = _smartOutputConsoleProvider;
            _providerSettings = providerServices.ProviderSettings;
            _updateAllUIService = providerServices.UpdateAllUIService;
            providerServices.ProgressWindow.UpgradeNuGetRequested += (_, __) =>
                {
                    Close();
                    productUpdateService.Update();
                };

            AddUpdateBar(productUpdateService);
            AddRestoreBar(packageRestoreManager);
            var restartRequestBar = AddRestartRequestBar(deleteOnRestartManager, vsRestarter);
            InsertDisclaimerElement();
            AdjustSortComboBoxWidth();
            PreparePrereleaseComboBox();
            InsertUpdateAllButton(providerServices.UpdateAllUIService);

            SetupProviders(
                project,
                dte,
                packageManagerFactory,
                repositoryFactory,
                packageSourceProvider,
                providerServices,
                httpClientEvents,
                solutionManager,
                packageRestoreManager,
                restartRequestBar);

            ProcessDialogParameters(dialogParameters);
        }
Example #58
0
 protected ProcessPackageBaseCommand(ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IHttpClientEvents httpClientEvents)
     : base(solutionManager, packageManagerFactory, httpClientEvents)
 {
 }