2
0

IScheduledTask.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using MediaBrowser.Model.Tasks;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading.Tasks;
  5. namespace MediaBrowser.Common.ScheduledTasks
  6. {
  7. /// <summary>
  8. /// Interface IScheduledTask
  9. /// </summary>
  10. public interface IScheduledTask : IDisposable
  11. {
  12. /// <summary>
  13. /// Gets the triggers.
  14. /// </summary>
  15. /// <value>The triggers.</value>
  16. IEnumerable<ITaskTrigger> Triggers { get; set; }
  17. /// <summary>
  18. /// Gets the last execution result.
  19. /// </summary>
  20. /// <value>The last execution result.</value>
  21. TaskResult LastExecutionResult { get; }
  22. /// <summary>
  23. /// Gets the state.
  24. /// </summary>
  25. /// <value>The state.</value>
  26. TaskState State { get; }
  27. /// <summary>
  28. /// Gets the current progress.
  29. /// </summary>
  30. /// <value>The current progress.</value>
  31. double? CurrentProgress { get; }
  32. /// <summary>
  33. /// Gets the name of the task
  34. /// </summary>
  35. /// <value>The name.</value>
  36. string Name { get; }
  37. /// <summary>
  38. /// Gets the description.
  39. /// </summary>
  40. /// <value>The description.</value>
  41. string Description { get; }
  42. /// <summary>
  43. /// Gets the category.
  44. /// </summary>
  45. /// <value>The category.</value>
  46. string Category { get; }
  47. /// <summary>
  48. /// Gets the unique id.
  49. /// </summary>
  50. /// <value>The unique id.</value>
  51. Guid Id { get; }
  52. /// <summary>
  53. /// Executes the task
  54. /// </summary>
  55. /// <returns>Task.</returns>
  56. /// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
  57. Task Execute();
  58. /// <summary>
  59. /// Stops the task if it is currently executing
  60. /// </summary>
  61. /// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
  62. void Cancel();
  63. /// <summary>
  64. /// Cancels if running.
  65. /// </summary>
  66. void CancelIfRunning();
  67. /// <summary>
  68. /// Gets the default triggers.
  69. /// </summary>
  70. /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
  71. IEnumerable<ITaskTrigger> GetDefaultTriggers();
  72. }
  73. }