// -- FILE ------------------------------------------------------------------ // name : LocalizationDesigner.Web.cs // project : Itenso String Resources // created : Jani Giannoudis - 2012.03.21 // language : c# // environment: .NET 4.0 // copyright : (c) 2004-2012 by Itenso GmbH, Switzerland // -------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Web.UI.Design; namespace Itenso.Community.StringResources.ResStrings { // ------------------------------------------------------------------------ public class LocalizationDesigner : ControlDesigner { // ---------------------------------------------------------------------- public override string GetDesignTimeHtml() { Localization localization = Component as Localization; if ( localization == null || string.IsNullOrEmpty( localization.SourceValue ) ) { return string.Format( sourceValueFormat, undefinedLocalization ); } return string.Format( sourceValueFormat, localization.SourceValue ); } // GetDesignTimeHtml // ---------------------------------------------------------------------- public override void Initialize( IComponent component ) { // throw an exception if the designer is attached to a control for which it is not intended if ( !( component is Localization ) ) { throw new InvalidOperationException( GetType().FullName + " only supports controls derived from Localization" ); } base.Initialize( component ); } // Initialize // ---------------------------------------------------------------------- // members private const string undefinedLocalization = "Loc"; private const string sourceValueFormat = "<font size=\"2\" color=\"#FF9933\"> [{0}]</font>"; } // class LocalizationDesigner } // namespace Itenso.Community.StringResources.ResStrings // -- EOF -------------------------------------------------------------------
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)