ITaskManager.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using MediaBrowser.Common.Events;
  2. using MediaBrowser.Model.Tasks;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.ScheduledTasks
  7. {
  8. public interface ITaskManager : IDisposable
  9. {
  10. /// <summary>
  11. /// Gets the list of Scheduled Tasks
  12. /// </summary>
  13. /// <value>The scheduled tasks.</value>
  14. IScheduledTaskWorker[] ScheduledTasks { get; }
  15. /// <summary>
  16. /// Cancels if running and queue.
  17. /// </summary>
  18. /// <typeparam name="T"></typeparam>
  19. void CancelIfRunningAndQueue<T>()
  20. where T : IScheduledTask;
  21. /// <summary>
  22. /// Queues the scheduled task.
  23. /// </summary>
  24. /// <typeparam name="T"></typeparam>
  25. void QueueScheduledTask<T>()
  26. where T : IScheduledTask;
  27. /// <summary>
  28. /// Queues the scheduled task.
  29. /// </summary>
  30. /// <param name="task">The task.</param>
  31. void QueueScheduledTask(IScheduledTask task);
  32. /// <summary>
  33. /// Adds the tasks.
  34. /// </summary>
  35. /// <param name="tasks">The tasks.</param>
  36. void AddTasks(IEnumerable<IScheduledTask> tasks);
  37. void Cancel(IScheduledTaskWorker task);
  38. Task Execute(IScheduledTaskWorker task);
  39. event EventHandler<EventArgs> TaskExecuting;
  40. event EventHandler<GenericEventArgs<TaskResult>> TaskCompleted;
  41. }
  42. }