예제 #1
0
파일: RuntimeTimer.cs 프로젝트: lulzzz/WF
        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();
        }
예제 #2
0
파일: RuntimeTimer.cs 프로젝트: jiguixin/WF
        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();
        }