/// <summary> /// Removes the specified queue from the queue collection. /// </summary> /// <param name="queue"></param> /// <returns></returns> public static bool Remove(TaskQueue queue) { return _queues.Remove(queue.Tag); }
public TaskContext(TaskQueue queue, Func<TaskContext, CancellationToken, Task> action, string taskTag) { this.Queue = queue; this.Action = action; this.Tag = taskTag; }
/// <summary> /// Creates a queue. /// </summary> /// <param name="tag"></param> /// <param name="data"></param> /// <returns></returns> public static TaskQueue Create(string tag, object data = null) { if (string.IsNullOrWhiteSpace(tag)) throw new ArgumentNullException("tag", "Null, whitespaces or an empty string is not allowed for tags."); try { var queue = new TaskQueue(tag, data); _queues[tag] = queue; return queue; } catch (Exception) { throw new InvalidOperationException("Already exists a queue with the specified tag."); } }
public TaskContext(TaskQueue queue, Func<TaskContext, CancellationToken, Task> action) { this.Queue = queue; this.Action = action; }