#region Using using System; using System.IO; using System.Web; using System.Web.Hosting; using System.Web.UI; using System.Threading; using System.Xml; using System.Xml.Serialization; using BlogEngine.Core; using BlogEngine.Core.DataStore; using System.Collections.Specialized; #endregion /// /// Summary description for WidgetBase /// public abstract class WidgetEditBase : UserControl { #region Properties private string _Title; /// /// Gets or sets the title of the widget. It is mandatory for all widgets to set the Title. /// /// The title of the widget. public string Title { get { return _Title; } set { _Title = value; } } private bool _ShowTitle; /// /// Gets or sets a value indicating whether [show title]. /// /// true if [show title]; otherwise, false. public bool ShowTitle { get { return _ShowTitle; } set { _ShowTitle = value; } } private Guid _WidgetID; /// /// Gets the widget ID. /// /// The widget ID. public Guid WidgetID { get { return _WidgetID; } set { _WidgetID = value; } } #endregion /// /// Saves this the basic widget settings such as the Title. /// public abstract void Save(); #region Settings /// /// Get settings from data store /// /// Settings public StringDictionary GetSettings() { string cacheId = "be_widget_" + WidgetID; if (Cache[cacheId] == null) { WidgetSettings ws = new WidgetSettings(WidgetID.ToString()); Cache[cacheId] = (StringDictionary)ws.GetSettings(); } return (StringDictionary)Cache[cacheId]; } /// /// Saves settings to data store /// /// Settings protected virtual void SaveSettings(StringDictionary settings) { string cacheId = "be_widget_" + WidgetID; WidgetSettings ws = new WidgetSettings(WidgetID.ToString()); ws.SaveSettings(settings); Cache[cacheId] = settings; } #endregion public static event EventHandler Saved; /// /// Occurs when the class is Saved /// public static void OnSaved() { if (Saved != null) { Saved(null, new EventArgs()); } } }