ITaskManager.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma warning disable CS1591
  2. #pragma warning disable SA1600
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Model.Events;
  7. namespace MediaBrowser.Model.Tasks
  8. {
  9. public interface ITaskManager : IDisposable
  10. {
  11. /// <summary>
  12. /// Gets the list of Scheduled Tasks
  13. /// </summary>
  14. /// <value>The scheduled tasks.</value>
  15. IScheduledTaskWorker[] ScheduledTasks { get; }
  16. /// <summary>
  17. /// Cancels if running and queue.
  18. /// </summary>
  19. /// <typeparam name="T"></typeparam>
  20. /// <param name="options">Task options.</param>
  21. void CancelIfRunningAndQueue<T>(TaskOptions options)
  22. where T : IScheduledTask;
  23. /// <summary>
  24. /// Cancels if running and queue.
  25. /// </summary>
  26. /// <typeparam name="T"></typeparam>
  27. void CancelIfRunningAndQueue<T>()
  28. where T : IScheduledTask;
  29. /// <summary>
  30. /// Cancels if running.
  31. /// </summary>
  32. /// <typeparam name="T"></typeparam>
  33. void CancelIfRunning<T>()
  34. where T : IScheduledTask;
  35. /// <summary>
  36. /// Queues the scheduled task.
  37. /// </summary>
  38. /// <typeparam name="T"></typeparam>
  39. /// <param name="options">Task options.</param>
  40. void QueueScheduledTask<T>(TaskOptions options)
  41. where T : IScheduledTask;
  42. /// <summary>
  43. /// Queues the scheduled task.
  44. /// </summary>
  45. /// <typeparam name="T"></typeparam>
  46. void QueueScheduledTask<T>()
  47. where T : IScheduledTask;
  48. void QueueIfNotRunning<T>()
  49. where T : IScheduledTask;
  50. /// <summary>
  51. /// Queues the scheduled task.
  52. /// </summary>
  53. void QueueScheduledTask(IScheduledTask task, TaskOptions options);
  54. /// <summary>
  55. /// Adds the tasks.
  56. /// </summary>
  57. /// <param name="tasks">The tasks.</param>
  58. void AddTasks(IEnumerable<IScheduledTask> tasks);
  59. void Cancel(IScheduledTaskWorker task);
  60. Task Execute(IScheduledTaskWorker task, TaskOptions options);
  61. void Execute<T>()
  62. where T : IScheduledTask;
  63. event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
  64. event EventHandler<TaskCompletionEventArgs> TaskCompleted;
  65. }
  66. }