using System; using CMS.CMSHelper; using CMS.GlobalHelper; using CMS.PortalControls; using CMS.PortalEngine; public partial class CMSWebParts_General_Timer : CMSAbstractWebPart { #region "Public properties" /// /// Refresh interval. /// public int Interval { get { return ValidationHelper.GetInteger(GetValue("Interval"), 1000); } set { SetValue("Interval", value); } } #endregion #region "Page events" /// /// Loads the web part content. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } #endregion #region "Other methods" /// /// Sets up the control. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { if ((CMSContext.ViewMode == ViewModeEnum.LiveSite) || (CMSContext.ViewMode == ViewModeEnum.Preview)) { if (timElem.Interval > 0) { timElem.Interval = Interval; } else { timElem.Enabled = false; } } } } #endregion #region "Control events" protected void timElem_Tick(object sender, EventArgs e) { // Do nothing } #endregion }