public static void RemoveControl(IUpdateRate update) { UpdateRateTimer.m_ControlList.Remove(update); if (UpdateRateTimer.m_ControlList.Count == 0) { UpdateRateTimer.m_Timer.Enabled = false; UpdateRateTimer.m_Timer.Dispose(); UpdateRateTimer.m_Timer = null; } }
public static void AddControl(IUpdateRate update) { UpdateRateTimer.m_ControlList.Add(update); if (UpdateRateTimer.m_Timer == null) { UpdateRateTimer.m_Timer = new Timer(); UpdateRateTimer.m_Timer.Interval = 100; UpdateRateTimer.m_Timer.Enabled = true; UpdateRateTimer.m_Timer.Tick += UpdateRateTimer.m_Timer_Tick; } }
internal override void Reload(API api, ref double maxValue) { base.Reload(api, ref maxValue); _urls = ReadUrls(api); _timeout = TimeSpan.FromMilliseconds(api.ReadInt("Timeout", DEFAULT_LOAD_TIMEOUT_MILLIS)); Parallel = api.ReadInt("Parallel", 0) == 1; _updateRate = CreateUpdateRate(api); Log(API.LogType.Debug, "FeedParser reloaded"); //TODO crash if Prefixes=#Prefixes# and #Prefixes# is not set Prefixes = ReadPrefixes(api); }
public static bool NeedsUpdate(IUpdateRate update) { if (update.FrameRate == 0.0) { return(false); } if (update.Active) { return(false); } if (!update.Needed) { return(false); } DateTime now = DateTime.Now; if (Math2.DateTimeToDouble(now) > Math2.DateTimeToDouble(update.LastRepaintTime) + 1.0 / update.FrameRate * 1.0 / 86400.0) { return(true); } return(false); }