Example #1
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private static void Initialize()
        {
            try
            {
                //Get the feature's configuration info
                HtmlEditorConfiguration qc =
                    (HtmlEditorConfiguration)ConfigurationManager.GetSection("HtmlEditorProvider");

                if (qc.DefaultProvider == null || qc.Providers == null || qc.Providers.Count < 1)
                    throw new ProviderException("You must specify a valid default provider.");

                //Instantiate the providers
                providerCollection = new HtmlEditorProviderCollection();
                ProvidersHelper.InstantiateProviders(qc.Providers, providerCollection, typeof(HtmlEditorProvider));
                providerCollection.SetReadOnly();
                defaultProvider = providerCollection[qc.DefaultProvider];
                if (defaultProvider == null)
                {
                    throw new ConfigurationErrorsException(
                        "You must specify a default provider for the feature.",
                        qc.ElementInformation.Properties["defaultProvider"].Source,
                        qc.ElementInformation.Properties["defaultProvider"].LineNumber);
                }
            }
            catch (Exception ex)
            {
                initializationException = ex;
                isInitialized = true;
                throw ex;
            }

            isInitialized = true; //error-free initialization
        }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private static void Initialize()
        {
            //Get the feature's configuration info
            var qc = ConfigurationManager.GetSection("HtmlEditorProvider") as HtmlEditorConfiguration;

            if (qc != null && (qc.DefaultProvider == null || qc.Providers == null || qc.Providers.Count < 1))
                throw new ProviderException("You must specify a valid default provider.");

            //Instantiate the providers
            providerCollection = new HtmlEditorProviderCollection();
            ProvidersHelper.InstantiateProviders(qc.Providers, providerCollection, typeof(HtmlEditorProvider));
            providerCollection.SetReadOnly();
            defaultProvider = providerCollection[qc.DefaultProvider];

            if (defaultProvider == null)
            {
                throw new ConfigurationErrorsException(
                    "You must specify a default provider for the feature.",
                    qc.ElementInformation.Properties["defaultProvider"].Source,
                    qc.ElementInformation.Properties["defaultProvider"].LineNumber);
            }
        }
Example #3
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private static void Initialize()
        {
            //Get the feature's configuration info
            var qc = ConfigurationManager.GetSection("HtmlEditorProvider") as HtmlEditorConfiguration;

            if (qc != null && (qc.DefaultProvider == null || qc.Providers == null || qc.Providers.Count < 1))
            {
                throw new ProviderException("You must specify a valid default provider.");
            }

            //Instantiate the providers
            providerCollection = new HtmlEditorProviderCollection();
            ProvidersHelper.InstantiateProviders(qc.Providers, providerCollection, typeof(HtmlEditorProvider));
            providerCollection.SetReadOnly();
            defaultProvider = providerCollection[qc.DefaultProvider];

            if (defaultProvider == null)
            {
                throw new ConfigurationErrorsException(
                          "You must specify a default provider for the feature.",
                          qc.ElementInformation.Properties["defaultProvider"].Source,
                          qc.ElementInformation.Properties["defaultProvider"].LineNumber);
            }
        }