Esempio n. 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
        }
Esempio n. 2
0
         /// <summary>
         /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
         /// </summary>
         /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
         protected override void OnInit(EventArgs e) 
         {
             try
             {
                 p = HtmlEditorManager.Provider;
                 p.ControlId = this.ID;
            
                 if (_height != Unit.Empty)
                     p.Height = _height;
                 if (_width != Unit.Empty)
                     p.Width = _width;

                 this.Controls.Add(p.HtmlEditor);
             }
             catch (Exception ex)
             {
                 Log.Error(this, new Exception(string.Format("An error occurred initializing the HtmlEditorProvider: {0} \n\n {1}", ex.Message, ex.StackTrace)));
                 // Throw an exception now so you don't get exceptions when 
                 // other pages try to work with the control.
                 Response.Redirect("~/Errors/Error.aspx");
                 // throw new Exception("An error occurred initializing the HtmlEditorProvider. See log for details.");
             }          
        }
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="array">The array.</param>
 /// <param name="index">The index.</param>
 public void CopyTo(HtmlEditorProvider[] array, int index)
 {
     base.CopyTo(array, index);
 }