using MediaBrowser.Model.Events; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace MediaBrowser.Common.ScheduledTasks { public interface ITaskManager : IDisposable { /// /// Gets the list of Scheduled Tasks /// /// The scheduled tasks. IScheduledTaskWorker[] ScheduledTasks { get; } /// /// Cancels if running and queue. /// /// /// Task options. void CancelIfRunningAndQueue(TaskExecutionOptions options = null) where T : IScheduledTask; /// /// Cancels if running. /// /// void CancelIfRunning() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// /// Task options. void QueueScheduledTask(TaskExecutionOptions options = null) where T : IScheduledTask; /// /// Queues the scheduled task. /// /// The task. /// The task run options. void QueueScheduledTask(IScheduledTask task, TaskExecutionOptions options = null); /// /// Adds the tasks. /// /// The tasks. void AddTasks(IEnumerable tasks); void Cancel(IScheduledTaskWorker task); Task Execute(IScheduledTaskWorker task, TaskExecutionOptions options = null); event EventHandler> TaskExecuting; event EventHandler TaskCompleted; } }