Exemplo n.º 1
0
        private void AddOrUpdateSystemTimer(TimerInfo item, bool scheduleSystemWakeTimer)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now       = DateTime.UtcNow;

            if (startDate < now)
            {
                EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs <TimerInfo> {
                    Argument = item
                }, Logger);
                return;
            }

            var dueTime = startDate - now;

            StartTimer(item, dueTime);

            if (scheduleSystemWakeTimer && dueTime >= TimeSpan.FromMinutes(15))
            {
                ScheduleSystemWakeTimer(startDate, item.Name);
            }
        }
Exemplo n.º 2
0
        private void AddOrUpdateSystemTimer(TimerInfo item)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now = DateTime.UtcNow;

            if (startDate < now)
            {
                EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = item }, Logger);
                return;
            }

            var dueTime = startDate - now;
            StartTimer(item, dueTime);
        }
Exemplo n.º 3
0
        private void AddOrUpdateSystemTimer(TimerInfo item)
        {
            StopTimer(item);

            if (!ShouldStartTimer(item))
            {
                return;
            }

            var startDate = RecordingHelper.GetStartTime(item);
            var now       = DateTime.UtcNow;

            if (startDate < now)
            {
                TimerFired?.Invoke(this, new GenericEventArgs <TimerInfo>(item));
                return;
            }

            var dueTime = startDate - now;

            StartTimer(item, dueTime);
        }