/// <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; }
/// <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); } }
public TaskInfo(int id, TaskPriorityEx priority, DateTime time) { Id = id; Priority = priority; Time = time; }