Пример #1
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="action">Задача для выполнения.</param>
 /// <param name="priority">Приоритет задачи.</param>
 public TaskEx(Action action, TaskPriorityEx priority = TaskPriorityEx.LOW)
 {
     this.action = action;
     Priority    = priority;
     Status      = TaskStatus.Whaiting;
     Tried       = false;
 }
Пример #2
0
        /// <summary>
        /// Выполнение то или иной задачи.
        /// </summary>
        /// <param name="action">Задача</param>
        /// <param name="priority">Приоритет</param>
        /// <returns>Поставлена задача в очередь</returns>
        public bool Execute(Action action, TaskPriorityEx priority = TaskPriorityEx.LOW)
        {
            if (!Stoping)
            {
                ClearTasks();

                TaskEx taskEx = new TaskEx(action, priority);
                tasks.Add(taskEx);
                waitHandle.Set();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 public TaskInfo(int id, TaskPriorityEx priority, DateTime time)
 {
     Id       = id;
     Priority = priority;
     Time     = time;
 }