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