using MediaBrowser.Common.Events; using MediaBrowser.Model.Tasks; 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. /// /// void CancelIfRunningAndQueue() where T : IScheduledTask; /// /// Cancels if running. /// /// void CancelIfRunning() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// void QueueScheduledTask() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// The task. void QueueScheduledTask(IScheduledTask task); /// /// Adds the tasks. /// /// The tasks. void AddTasks(IEnumerable tasks); void Cancel(IScheduledTaskWorker task); Task Execute(IScheduledTaskWorker task); event EventHandler TaskExecuting; event EventHandler> TaskCompleted; } }