2013-03-07 05:34:00 +00:00
|
|
|
|
using MediaBrowser.Common.Events;
|
|
|
|
|
using MediaBrowser.Model.Tasks;
|
|
|
|
|
using System;
|
2013-02-23 07:57:11 +00:00
|
|
|
|
using System.Collections.Generic;
|
2013-03-07 05:34:00 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2013-02-23 07:57:11 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Common.ScheduledTasks
|
|
|
|
|
{
|
|
|
|
|
public interface ITaskManager : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the list of Scheduled Tasks
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The scheduled tasks.</value>
|
2013-02-26 03:43:04 +00:00
|
|
|
|
IScheduledTaskWorker[] ScheduledTasks { get; }
|
2013-02-23 07:57:11 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Cancels if running and queue.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void CancelIfRunningAndQueue<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2013-09-23 18:53:06 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Cancels if running.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void CancelIfRunning<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
2013-02-23 07:57:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Queues the scheduled task.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
void QueueScheduledTask<T>()
|
|
|
|
|
where T : IScheduledTask;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Queues the scheduled task.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">The task.</param>
|
|
|
|
|
void QueueScheduledTask(IScheduledTask task);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the tasks.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tasks">The tasks.</param>
|
|
|
|
|
void AddTasks(IEnumerable<IScheduledTask> tasks);
|
2013-03-07 05:34:00 +00:00
|
|
|
|
|
|
|
|
|
void Cancel(IScheduledTaskWorker task);
|
|
|
|
|
Task Execute(IScheduledTaskWorker task);
|
|
|
|
|
|
|
|
|
|
event EventHandler<EventArgs> TaskExecuting;
|
|
|
|
|
event EventHandler<GenericEventArgs<TaskResult>> TaskCompleted;
|
2013-02-23 07:57:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|