FindProvider() public static method

Finds a provider.
public static FindProvider ( string typeName, bool &enabled, bool &canDisable ) : IProviderV30
typeName string The provider type name.
enabled bool A value indicating whether the provider is enabled.
canDisable bool A value indicating whether the provider can be disabled.
return IProviderV30
        /// <summary>
        /// Gets the currently selected provider.
        /// </summary>
        /// <returns>The provider.</returns>
        /// <param name="enabled">A value indicating whether the returned provider is enabled.</param>
        /// <param name="canDisable">A value indicating whether the returned provider can be disabled.</param>
        private IProviderV30 GetCurrentProvider(out bool enabled)
        {
            enabled = true;
            bool canDisable;

            return(Collectors.FindProvider(txtCurrentProvider.Value, out enabled, out canDisable));
        }
Beispiel #2
0
        /// <summary>
        /// Enables a provider.
        /// </summary>
        /// <param name="typeName">The provider to enable.</param>
        public static void EnableProvider(string typeName)
        {
            bool         enabled, canDisable;
            IProviderV30 provider = Collectors.FindProvider(typeName, out enabled, out canDisable);

            if (!enabled)
            {
                provider.Init(Host.Instance, LoadConfiguration(typeName));
                Collectors.TryEnable(typeName);
                SaveStatus(typeName, true);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Disables a provider.
        /// </summary>
        /// <param name="typeName">The provider to disable.</param>
        public static void DisableProvider(string typeName)
        {
            bool         enabled, canDisable;
            IProviderV30 provider = Collectors.FindProvider(typeName, out enabled, out canDisable);

            if (enabled && canDisable)
            {
                provider.Shutdown( );
                Collectors.TryDisable(typeName);
                SaveStatus(typeName, false);
            }
        }
        /// <summary>
        /// Tries to change a provider's configuration.
        /// </summary>
        /// <param name="typeName">The provider.</param>
        /// <param name="configuration">The new configuration.</param>
        /// <param name="error">The error message, if any.</param>
        /// <returns><c>true</c> if the configuration is saved, <c>false</c> if the provider rejected it.</returns>
        public static bool TryChangeConfiguration(string typeName, string configuration, out string error)
        {
            error = null;

            bool         enabled, canDisable;
            IProviderV30 provider = Collectors.FindProvider(typeName, out enabled, out canDisable);

            try {
                provider.Init(Host.Instance, configuration);
            }
            catch (InvalidConfigurationException icex) {
                error = icex.Message;
                return(false);
            }

            SaveConfiguration(typeName, configuration);
            return(true);
        }
Beispiel #5
0
        /// <summary>
        /// Gets the currently selected provider.
        /// </summary>
        /// <returns>The provider.</returns>
        /// <param name="enabled">A value indicating whether the returned provider is enabled.</param>
        /// <param name="canDisable">A value indicating whether the returned provider can be disabled.</param>
        private IProviderV40 GetCurrentProvider(out bool enabled)
        {
            enabled = true;

            return(Collectors.FindProvider(currentWiki, txtCurrentProvider.Value, out enabled));
        }