private void SetTimer(Guid processId, TimeSpan interval, string name) { _lock.AcquireWriterLock(_lockTimeout); try { IDictionary <string, DateTime> processTimers; var key = new TimerKey { ProcessId = processId, TimerName = name }; if (Timers.ContainsKey(key)) { Timers[key] = DateTime.UtcNow.Add(interval); } else { Timers.Add(key, DateTime.UtcNow.Add(interval)); } if (NeedSave != null) { NeedSave(this, EventArgs.Empty); } } finally { _lock.ReleaseWriterLock(); } RefreshTimer(); }
private void SetTimer(Guid processId, TimeSpan interval, string name) { _lock.AcquireWriterLock(_lockTimeout); try { IDictionary<string, DateTime> processTimers; var key = new TimerKey {ProcessId = processId, TimerName = name}; if (Timers.ContainsKey(key)) { Timers[key] = DateTime.UtcNow.Add(interval); } else { Timers.Add(key, DateTime.UtcNow.Add(interval)); } if (NeedSave != null) NeedSave(this, EventArgs.Empty); } finally { _lock.ReleaseWriterLock(); } RefreshTimer(); }