using System; using System.Collections.Generic; using System.Threading.Tasks; using MediaBrowser.Model.Events; namespace MediaBrowser.Model.Tasks { 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) where T : IScheduledTask; /// /// Cancels if running and queue. /// /// void CancelIfRunningAndQueue() where T : IScheduledTask; /// /// Cancels if running. /// /// void CancelIfRunning() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// /// Task options. void QueueScheduledTask(TaskExecutionOptions options) where T : IScheduledTask; /// /// Queues the scheduled task. /// /// void QueueScheduledTask() where T : IScheduledTask; void QueueIfNotRunning() 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); void Execute() where T : IScheduledTask; event EventHandler> TaskExecuting; event EventHandler TaskCompleted; void RunTaskOnNextStartup(string key); } }