Пример #1
0
 private bool IsTaskCategoryRunning(PiTask task)
 {
     for (int i = 0; i < _runningTasks.Count; i++)
     {
         var t = _runningTasks[i];
         if (t.Category == task.Category)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Enqueues a task at the correct index based on <see cref="PiTask.NextOccurrence"/>.
        /// </summary>
        public void Enqueue(PiTask task)
        {
            var taskCount = _tasks.Count;

            for (int i = 0; i < taskCount; i++)
            {
                var t = (_tasks[i]);
                if (task.NextOccurrence <= t.NextOccurrence)
                {
                    _tasks.Insert(i, task);
                    return;
                }
            }

            _tasks.Add(task);
        }
Пример #3
0
 private void RunTask(PiTask task)
 {
     task.Execute();
     _taskQueue.Enqueue(task);
 }