2016-10-23 12:47:34 -07:00
|
|
|
|
using System;
|
2013-02-23 00:57:11 -07:00
|
|
|
|
using System.Collections.Generic;
|
2013-03-06 22:34:00 -07:00
|
|
|
|
using System.Threading.Tasks;
|
2016-10-23 12:47:34 -07:00
|
|
|
|
using MediaBrowser.Model.Events;
|
2013-02-23 00:57:11 -07:00
|
|
|
|
|
2016-10-23 12:47:34 -07:00
|
|
|
|
namespace MediaBrowser.Model.Tasks
|
2013-02-23 00:57:11 -07:00
|
|
|
|
{
|
|
|
|
|
public interface ITaskManager : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the list of Scheduled Tasks
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The scheduled tasks.</value>
|
2013-02-25 20:43:04 -07:00
|
|
|
|
IScheduledTaskWorker[] ScheduledTasks { get; }
|
2013-02-23 00:57:11 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Cancels if running and queue.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
2015-02-25 13:55:01 -07:00
|
|
|
|
/// <param name="options">Task options.</param>
|
2015-03-07 10:19:44 -07:00
|
|
|
|
void CancelIfRunningAndQueue<T>(TaskExecutionOptions options)
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Cancels if running and queue.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void CancelIfRunningAndQueue<T>()
|
2013-02-23 00:57:11 -07:00
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2013-09-23 11:53:06 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Cancels if running.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void CancelIfRunning<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2013-02-23 00:57:11 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Queues the scheduled task.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
2015-02-25 13:55:01 -07:00
|
|
|
|
/// <param name="options">Task options.</param>
|
2015-03-07 10:19:44 -07:00
|
|
|
|
void QueueScheduledTask<T>(TaskExecutionOptions options)
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Queues the scheduled task.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void QueueScheduledTask<T>()
|
2013-02-23 00:57:11 -07:00
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2016-03-20 20:04:44 -07:00
|
|
|
|
void QueueIfNotRunning<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2013-02-23 00:57:11 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Queues the scheduled task.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">The task.</param>
|
2015-02-25 13:55:01 -07:00
|
|
|
|
/// <param name="options">The task run options.</param>
|
|
|
|
|
void QueueScheduledTask(IScheduledTask task, TaskExecutionOptions options = null);
|
2013-02-23 00:57:11 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the tasks.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tasks">The tasks.</param>
|
|
|
|
|
void AddTasks(IEnumerable<IScheduledTask> tasks);
|
2013-03-06 22:34:00 -07:00
|
|
|
|
|
|
|
|
|
void Cancel(IScheduledTaskWorker task);
|
2015-02-25 13:55:01 -07:00
|
|
|
|
Task Execute(IScheduledTaskWorker task, TaskExecutionOptions options = null);
|
2013-03-06 22:34:00 -07:00
|
|
|
|
|
2016-02-03 13:52:45 -07:00
|
|
|
|
void Execute<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2014-05-10 10:28:03 -07:00
|
|
|
|
event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
|
|
|
|
|
event EventHandler<TaskCompletionEventArgs> TaskCompleted;
|
2013-02-23 00:57:11 -07:00
|
|
|
|
}
|
|
|
|
|
}
|