|
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.Web.Configuration;
namespace SeaburyDesign
{
public class HTMLEditorManager
{
//Initialization related variables and logic
private static bool isInitialized = false;
private static Exception initializationException;
private static object initializationLock = new object();
static HTMLEditorManager()
{
Initialize();
}
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
}
//Public feature API
private static HTMLEditorProvider defaultProvider;
private static HTMLEditorProviderCollection providerCollection;
public static HTMLEditorProvider Provider
{
get
{
return defaultProvider;
}
}
public static HTMLEditorProviderCollection Providers
{
get
{
return providerCollection;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Todd Davis has been working in web and application development for several years, using Silverlight, ASP.NET, VB.NET, C#, C++ and Javascript, as well as a great deal of work with SQL server and IIS.
He currently works for Virtual Radiologic in Eden Prairie, MN, however he is better known for his varied work in the open source community, especially the DotNetNuke project for which he provided several world-renowned training videos and modules. A huge advocate of open source and open knowledge sharing, everything on his website (www.SeaburyDesign.com) is always offered for free.
Whenever he is not actively coding at his laptop (a rarity to be sure), he can be found woodworking, walking with his wife and kids, or motoring along the back roads of MN on his Harley Davidson Fatboy.