ITaskManager.cs 2.3 KB

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