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);
        }
示例#2
0
        public object Save(object saveData)
        {
            Debug.Assert(saveData != null, "Expecting a non-null instance of a class to save settings into");
            Debug.Assert(saveData is IProviderSettings, "Expecting save object to be an IProviderSettings");

            IProviderSettings settings = saveData as IProviderSettings;

            if (settings != null)
            {
                IFileMonitoringProviderSettings fileSettings = settings as IFileMonitoringProviderSettings;

                if (fileSettings != null)
                {
                    fileSettings.Update(fileName, (int)Refresh, LoadExisting);
                    return(fileSettings);
                }

                return(new FileMonitoringProviderSettings(
                           settings.Info,
                           settings.Name,
                           fileName,
                           (int)Refresh,
                           LoadExisting));
            }

            return(saveData);
        }
示例#3
0
        public FileMonitoringProvider(IProviderSettings settings)
        {
            Debug.Assert(
                settings is IFileMonitoringProviderSettings,
                "The FileMonitoringProvider class expects configuration information "
                + "to be of IFileMonitoringProviderSettings type");

            var fileSettings = (IFileMonitoringProviderSettings)settings;

            ProviderSettings    = fileSettings;
            FileName            = fileSettings.FileName;
            Information         = settings.Info;
            refreshInterval     = fileSettings.RefreshPeriod;
            loadExistingContent = fileSettings.LoadExistingContent;
            patternMatching     = new Regex(fileSettings.MessageDecoder, RegexOptions.Singleline | RegexOptions.Compiled);

            PredetermineGroupNames(fileSettings.MessageDecoder);

            worker                     = new BackgroundWorker();
            worker.DoWork             += DoWork;
            worker.RunWorkerCompleted += DoWorkComplete;

            purgeWorker = new BackgroundWorker {
                WorkerReportsProgress = true
            };
            purgeWorker.DoWork += PurgeWorkerDoWork;
        }
        public bool Display(Window parent)
        {
            IProviderSettings settings = new ProviderSettings();

            // Construct the wizard
            Wizard wizard = new Wizard
                                {
                                    Owner = parent,
                                    ShowNavigationTree = false,
                                    SavedData = settings,
                                    Title = "Add New Log Provider"
                                };

            wizard.AddPage(new SelectProviderPage());

            var dialogResult = wizard.ShowDialog();
            if (dialogResult == true)
            {
                if (wizard.SavedData == null && !(wizard.SavedData is IProviderSettings))
                {
                    throw new NotImplementedException(
                        "The UserData was either null or the supplied object was not of the expected type: IProviderSettings");
                }

                Settings = (IProviderSettings)wizard.SavedData;
                Provider = Settings.Info;
            }

            return dialogResult ?? false;
        }
示例#5
0
        public FileMonitoringProvider(IProviderSettings settings)
        {
            settings.ThrowIfNull(nameof(settings));

            var fileSettings = settings as IFileMonitoringProviderSettings;

            Debug.Assert(
                fileSettings != null,
                "The FileMonitoringProvider class expects configuration information "
                + "to be of IFileMonitoringProviderSettings type");

            ProviderSettings    = fileSettings;
            FileName            = fileSettings.FileName;
            Information         = settings.Info;
            refreshInterval     = fileSettings.RefreshPeriod;
            loadExistingContent = fileSettings.LoadExistingContent;
            patternMatching     = new Regex(fileSettings.MessageDecoder, RegexOptions.Singleline | RegexOptions.Compiled);

            PredetermineGroupNames(fileSettings.MessageDecoder);

            // Chain up callbacks to the workers.
            Worker.DoWork             += DoWork;
            Worker.RunWorkerCompleted += DoWorkComplete;
            PurgeWorker.DoWork        += PurgeWorkerDoWork;
        }
示例#6
0
        public bool Display(Window parent)
        {
            IProviderSettings settings = new ProviderSettings();

            // Construct the wizard
            var wizard = new Wizard
            {
                Owner = parent,
                ShowNavigationTree = false,
                SavedData          = settings,
                Title = "Add New Log Provider",
            };

            wizard.AddPage(new SelectProviderPage());

            var dialogResult = wizard.ShowDialog();

            if (dialogResult == true)
            {
                if (wizard.SavedData == null && !(wizard.SavedData is IProviderSettings))
                {
                    throw new NotImplementedException(
                              "The UserData was either null or the supplied object was not of the expected type: IProviderSettings");
                }

                Settings = (IProviderSettings)wizard.SavedData;
                Provider = Settings.Info;
            }

            return(dialogResult ?? false);
        }
示例#7
0
        public MsBuildProvider(IProviderSettings settings)
        {
            settings.ThrowIfNull(nameof(settings));

            Settings = settings as IMsBuildListenerSettings;
            Settings.ThrowIfNull(nameof(Settings));

            ProviderSettings = settings;
        }
示例#8
0
 public void SetSelectedType(string type)
 {
     SelectedType      = Array.IndexOf(TypeStrings, type);
     _providerSettings = GetProviderSettingsFor(type);
     if (_providerSettings != null)
     {
         _providerSettings.Init();
     }
 }
示例#9
0
        public NLogViewerProvider(IProviderSettings settings)
        {
            settings.ThrowIfNull(nameof(settings));

            networkSettings = settings as INLogAppenderSettings;
            networkSettings.ThrowIfNull(nameof(networkSettings));

            Information      = ProviderRegistrationInformation.Info;
            ProviderSettings = networkSettings;
        }
示例#10
0
        public Log4NetProvider(IProviderSettings settings)
        {
            settings.ThrowIfNull(nameof(settings));

            udpSettings = settings as IUdpAppenderListenerSettings;
            udpSettings.ThrowIfNull(nameof(udpSettings));

            Information      = ProviderRegistrationInformation.Info;
            ProviderSettings = udpSettings;
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of ProviderConfig with a specified collection 
        /// of provider descriptors and provider wide settings.
        /// </summary>
        /// <param name="providerDescriptors">It holds information regarding the providers.</param>
        /// <param name="settings">The provider wide settings.</param>
        public ProviderConfig(
            IEnumerable<IProviderDescriptor> providerDescriptors, IProviderSettings settings)
        {
            if (providerDescriptors == null || !providerDescriptors.Any())
            {
                throw new ArgumentException("providerDescriptors not set.");
            }

            Settings = settings;
            ProviderDescriptors = providerDescriptors;
        }
示例#12
0
        /// <summary>
        /// Initializes a new instance of ProviderConfig with a specified collection
        /// of provider descriptors and provider wide settings.
        /// </summary>
        /// <param name="providerDescriptors">It holds information regarding the providers.</param>
        /// <param name="settings">The provider wide settings.</param>
        public ProviderConfig(
            IEnumerable <IProviderDescriptor> providerDescriptors, IProviderSettings settings)
        {
            if (providerDescriptors == null || !providerDescriptors.Any())
            {
                throw new ArgumentException("providerDescriptors not set.");
            }

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

            InitializeComponent();

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

            _vsUIShell = vsUIShell;
            _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);
        }
        /// <summary>
        /// Initializes an instance of ProviderDescriptor using the specified provider details.
        /// </summary>
        /// <param name="providerName">The provider's name.</param>
        /// <param name="providerGroup">The provider's group.</param>
        /// <param name="providerType">The provider's type.</param>
        /// <param name="providerSettings">The provider's settings.</param>
        /// <param name="isEnabled">A value indicating whether or not the provider has been enabled.</param>
        public ProviderDescriptor(string providerName, string providerGroup,
            Type providerType, IProviderSettings providerSettings, bool isEnabled)
        {
            if (providerType == null)
            {
                throw new ArgumentNullException("providerType");
            }

            ProviderName = providerName;
            ProviderGroup = providerGroup;
            ProviderType = providerType;
            ProviderSettings = providerSettings;
            IsEnabled = isEnabled;
        }
        /// <summary>
        /// Initializes an instance of ProviderDescriptor using the specified provider details.
        /// </summary>
        /// <param name="providerName">The provider's name.</param>
        /// <param name="providerGroup">The provider's group.</param>
        /// <param name="providerType">The provider's type.</param>
        /// <param name="providerSettings">The provider's settings.</param>
        /// <param name="isEnabled">A value indicating whether or not the provider has been enabled.</param>
        public ProviderDescriptor(string providerName, string providerGroup,
                                  Type providerType, IProviderSettings providerSettings, bool isEnabled)
        {
            if (providerType == null)
            {
                throw new ArgumentNullException("providerType");
            }

            ProviderName     = providerName;
            ProviderGroup    = providerGroup;
            ProviderType     = providerType;
            ProviderSettings = providerSettings;
            IsEnabled        = isEnabled;
        }
示例#16
0
        public MSBuildProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            Settings = settings as IMSBuildListenerSettings;
            if ( Settings == null)
            {
                throw new ArgumentException("settings should be assignable to IMSBuildListenerSettings", "settings");
            }

            ProviderSettings = settings;
        }
示例#17
0
 public ProviderServices(
     IUserNotifierServices userNotifierServices,
     IProgressWindowOpener progressWindow,
     IProviderSettings selectedProviderSettings,
     IScriptExecutor scriptExecutor,
     IOutputConsoleProvider outputConsoleProvider,
     IVsCommonOperations vsCommonOperations)
 {
     UserNotifierServices  = userNotifierServices;
     ProgressWindow        = progressWindow;
     ScriptExecutor        = scriptExecutor;
     OutputConsoleProvider = outputConsoleProvider;
     ProviderSettings      = selectedProviderSettings;
     VsCommonOperations    = vsCommonOperations;
 }
示例#18
0
 public ProviderServices(
     IUserNotifierServices userNotifierServices,
     IProgressWindowOpener progressWindow,
     IProviderSettings selectedProviderSettings,
     IScriptExecutor scriptExecutor,
     IOutputConsoleProvider outputConsoleProvider,
     IVsCommonOperations vsCommonOperations)
 {
     UserNotifierServices = userNotifierServices;
     ProgressWindow = progressWindow;
     ScriptExecutor = scriptExecutor;
     OutputConsoleProvider = outputConsoleProvider;
     ProviderSettings = selectedProviderSettings;
     VsCommonOperations = vsCommonOperations;
 }
示例#19
0
        public MSBuildProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            Settings = settings as IMSBuildListenerSettings;
            if (Settings == null)
            {
                throw new ArgumentException("settings should be assignable to IMSBuildListenerSettings", "settings");
            }

            ProviderSettings = settings;
        }
示例#20
0
        public Log4NetProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            udpSettings = settings as IUdpAppenderListenerSettings;
            if (udpSettings == null)
            {
                throw new ArgumentException("settings should be assignable to IUdpAppenderListenerSettings", "settings");
            }

            Information = ProviderRegistrationInformation.Info;
            ProviderSettings = udpSettings;
        }
示例#21
0
        public Log4NetProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            udpSettings = settings as IUdpAppenderListenerSettings;
            if (udpSettings == null)
            {
                throw new ArgumentException("settings should be assignable to IUdpAppenderListenerSettings", "settings");
            }

            Information      = ProviderRegistrationInformation.Info;
            ProviderSettings = udpSettings;
        }
示例#22
0
        public NLogViewerProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            networkSettings = settings as INLogAppenderSettings;
            if (networkSettings == null)
            {
                throw new ArgumentException("settings should be assignable to INLogAppenderSettings", nameof(settings));
            }

            Information = ProviderRegistrationInformation.Info;
            ProviderSettings = networkSettings;
        }
示例#23
0
        public NLogViewerProvider(IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            networkSettings = settings as INLogAppenderSettings;
            if (networkSettings == null)
            {
                throw new ArgumentException("settings should be assignable to INLogAppenderSettings", nameof(settings));
            }

            Information      = ProviderRegistrationInformation.Info;
            ProviderSettings = networkSettings;
        }
示例#24
0
        public ILogProvider Create(Guid providerGuid, IProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentException("Settings can not be null", "Settings");
            }

            // Make sure we don't have any instances of that providerGuid.
            if (providerInstances.Any(p => p.Key == settings.Name && p.Value.Information.Identifier == providerGuid))
            {
                throw new ArgumentException(
                          "Already an instance of that ILoggerProvider with that name specified", "settings");
            }

            // Make sure that the type is supported.))
            if (providers.All(p => p.Identifier != providerGuid))
            {
                Trace.WriteLine("No provider with the identifier " + providerGuid + " is registered");
                return(null);
            }

            // Get an instance.
            var record = providers.FirstOrDefault(p => p.Identifier == providerGuid);

            if (record != null)
            {
                Debug.Assert(record.Implementor != null, "Need to know the implementing type for the provider");

                try
                {
                    var provider = (ILogProvider)Activator.CreateInstance(record.Implementor, settings);
                    providerInstances.Add(new KeyValuePair <string, ILogProvider>(settings.Name, provider));
                    return(provider);
                }
                catch (Exception e)
                {
                    Trace.TraceError(e.ToString());
                    Debugger.Break();
                }
            }

            return(null);
        }
            public void Should_not_throw_exception_when_settings_not_set()
            {
                IProviderSettings settings = null;
                var fooProviderName        = "Foo Provider";
                var fooProviderGroup       = "FooProviders";
                var fooProviderType        = typeof(FooProvider);
                var isFooProviderEnabled   = true;

                var providerDescriptor = new ProviderDescriptor(
                    fooProviderName,
                    fooProviderGroup,
                    fooProviderType,
                    settings,
                    isFooProviderEnabled
                    );

                Assert.That(providerDescriptor, Is.Not.Null);
                Assert.That(providerDescriptor.ProviderName, Is.EqualTo(fooProviderName));
                Assert.That(providerDescriptor.ProviderGroup, Is.EqualTo(fooProviderGroup));
                Assert.That(providerDescriptor.ProviderType, Is.EqualTo(fooProviderType));
                Assert.That(providerDescriptor.IsEnabled, Is.EqualTo(isFooProviderEnabled));
            }
示例#26
0
            public bool ShowDropDown(ref string eyeTrackingProviderTypeString, string label = null)
            {
                label = label == null?_targetGroup.ToString() : label;

                EditorGUI.BeginChangeCheck();
                var selected = EditorGUILayout.Popup(label, SelectedType, TypeStringDisplayNames);

                if (EditorGUI.EndChangeCheck())
                {
                    SelectedType = selected;
                    eyeTrackingProviderTypeString = TypeString;

                    _providerSettings = GetProviderSettingsFor(eyeTrackingProviderTypeString);
                    if (_providerSettings != null)
                    {
                        _providerSettings.Init();
                    }
                    return(true);
                }

                return(false);
            }
示例#27
0
        public FileMonitoringProvider(IProviderSettings settings)
        {
            Debug.Assert(
                settings is IFileMonitoringProviderSettings,
                "The FileMonitoringProvider class expects configuration information " + "to be of IFileMonitoringProviderSettings type");

            var fileSettings = (IFileMonitoringProviderSettings)settings;
            ProviderSettings = fileSettings;
            FileName = fileSettings.FileName;
            Name = fileSettings.Name;
            Information = settings.Info;
            _refreshInterval = fileSettings.RefreshPeriod;
            _loadExistingContent = fileSettings.LoadExistingContent;
            _patternMatching = new Regex(fileSettings.MessageDecoder, RegexOptions.Singleline | RegexOptions.Compiled);

            PredetermineGroupNames(fileSettings.MessageDecoder);

            _worker = new BackgroundWorker();
            _worker.DoWork += DoWork;
            _worker.RunWorkerCompleted += DoWorkComplete;

            PurgeWorker = new BackgroundWorker { WorkerReportsProgress = true };
            PurgeWorker.DoWork += PurgeWorkerDoWork;
        }
示例#28
0
 public UdpAppenderSettings(IProviderSettings providerInfo)
 {
     Name = providerInfo.Name;
     Info = providerInfo.Info;
     Summary = providerInfo.Summary;
 }
 public IIpRestrictionProvider CreateProvider(IUnitOfWork unitOfWork, IProviderSettings providerSettings)
 {
     IIpRestrictionProvider provider = new IisRestrictionProvider(unitOfWork, providerSettings);
     provider = new ExpiredIpRestrictionProvider(provider);
     return provider;
 }
示例#30
0
 public MSBuildListenerSettings(IProviderSettings providerSettings)
 {
     this.ProviderSettings = providerSettings;
 }
 public IIpRestrictionProvider CreateProvider(IUnitOfWork unitOfWork, IProviderSettings providerSettings)
 {
     return new MemoryStoredIpRestrictionProvider(unitOfWork, providerSettings);
 }
示例#32
0
 public UdpAppenderSettings(IProviderSettings providerInfo)
 {
     Name = providerInfo.Name;
     Info = providerInfo.Info;
 }
 public MemoryStoredIpRestrictionProvider(IUnitOfWork unitOfWork, IProviderSettings providerSettings)
 {
     _unitOfWork = unitOfWork;
     ProviderSettings = providerSettings;
 }
示例#34
0
 public DefaulProvider(IProviderSettings settings, IFileHelper fileHelper)
 {
     this.settings   = settings;
     this.fileHelper = fileHelper;
 }
        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);
        }
示例#36
0
 public MSBuildListenerSettings(IProviderSettings providerSettings)
 {
     ProviderSettings = providerSettings;
 }