private void HandleTimer(SafeTimer_SINGLE sender) { if (OnElapsed != null) { OnElapsed(); } }
private void HandleTimer(SafeTimer_SINGLE sender) { if (OnElapsed != null) OnElapsed(); }
private void OnTimedEvent(SafeTimer_SINGLE sender) { ArrayList eventList = new ArrayList(); lock (MonitorLock) { while (MonitorList.Count > 0 && ((DateTime)MonitorList.GetKey(0)).CompareTo(DateTime.Now.AddSeconds(0.05)) < 0) { eventList.Add(MonitorList.GetByIndex(0)); MonitorList.RemoveAt(0); } } foreach (object obj in eventList) OnExpiredEvent.Fire(this, obj); lock (MonitorLock) { if (MonitorList.Count > 0) { /* TimeSpan nextEventTime = ((DateTime)MonitorList.GetKey(0)).Subtract(DateTime.Now); if (nextEventTime.TotalMilliseconds<=0) { SafeNotifyTimer.Interval = 1; } else { SafeNotifyTimer.Interval = (int)nextEventTime.TotalMilliseconds; } SafeNotifyTimer.Start(); */ } } }
private void __NotifyCheck(SafeTimer_SINGLE sender) { if (OnRefresh != null) OnRefresh(); int MinVal = (int)((double)SSDP_EXPIRATION * 0.25 * 1000); int MaxVal = (int)((double)SSDP_EXPIRATION * 0.45 * 1000); //NotifyTimer.Interval = RND.Next(MinVal, MaxVal); }