diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-23 15:47:34 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-23 15:47:34 -0400 |
| commit | 0f8ccfaf496c3c761c06285574048f8866ef692c (patch) | |
| tree | d4100df4cd24facfe89a68e46a7a31f94be1d0ec /MediaBrowser.Common/ScheduledTasks | |
| parent | 07791d46a571d3d6eed23e98ec0fe1c46ea0d37f (diff) | |
prep for portable common
Diffstat (limited to 'MediaBrowser.Common/ScheduledTasks')
5 files changed, 0 insertions, 259 deletions
diff --git a/MediaBrowser.Common/ScheduledTasks/IScheduledTaskWorker.cs b/MediaBrowser.Common/ScheduledTasks/IScheduledTaskWorker.cs deleted file mode 100644 index a3a28684dd..0000000000 --- a/MediaBrowser.Common/ScheduledTasks/IScheduledTaskWorker.cs +++ /dev/null @@ -1,77 +0,0 @@ -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Tasks; -using System; - -namespace MediaBrowser.Common.ScheduledTasks -{ - /// <summary> - /// Interface IScheduledTaskWorker - /// </summary> - public interface IScheduledTaskWorker : IDisposable - { - /// <summary> - /// Occurs when [task progress]. - /// </summary> - event EventHandler<GenericEventArgs<double>> TaskProgress; - - /// <summary> - /// Gets or sets the scheduled task. - /// </summary> - /// <value>The scheduled task.</value> - IScheduledTask ScheduledTask { get; } - - /// <summary> - /// Gets the last execution result. - /// </summary> - /// <value>The last execution result.</value> - TaskResult LastExecutionResult { get; } - - /// <summary> - /// Gets the name. - /// </summary> - /// <value>The name.</value> - string Name { get; } - - /// <summary> - /// Gets the description. - /// </summary> - /// <value>The description.</value> - string Description { get; } - - /// <summary> - /// Gets the category. - /// </summary> - /// <value>The category.</value> - string Category { get; } - - /// <summary> - /// Gets the state. - /// </summary> - /// <value>The state.</value> - TaskState State { get; } - - /// <summary> - /// Gets the current progress. - /// </summary> - /// <value>The current progress.</value> - double? CurrentProgress { get; } - - /// <summary> - /// Gets the triggers that define when the task will run - /// </summary> - /// <value>The triggers.</value> - /// <exception cref="System.ArgumentNullException">value</exception> - TaskTriggerInfo[] Triggers { get; set; } - - /// <summary> - /// Gets the unique id. - /// </summary> - /// <value>The unique id.</value> - string Id { get; } - - /// <summary> - /// Reloads the trigger events. - /// </summary> - void ReloadTriggerEvents(); - } -}
\ No newline at end of file diff --git a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs b/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs deleted file mode 100644 index e557a6b2c3..0000000000 --- a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs +++ /dev/null @@ -1,81 +0,0 @@ -using MediaBrowser.Model.Events; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using MediaBrowser.Model.Tasks; - -namespace MediaBrowser.Common.ScheduledTasks -{ - public interface ITaskManager : IDisposable - { - /// <summary> - /// Gets the list of Scheduled Tasks - /// </summary> - /// <value>The scheduled tasks.</value> - IScheduledTaskWorker[] ScheduledTasks { get; } - - /// <summary> - /// Cancels if running and queue. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="options">Task options.</param> - void CancelIfRunningAndQueue<T>(TaskExecutionOptions options) - where T : IScheduledTask; - - /// <summary> - /// Cancels if running and queue. - /// </summary> - /// <typeparam name="T"></typeparam> - void CancelIfRunningAndQueue<T>() - where T : IScheduledTask; - - /// <summary> - /// Cancels if running. - /// </summary> - /// <typeparam name="T"></typeparam> - void CancelIfRunning<T>() - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="options">Task options.</param> - void QueueScheduledTask<T>(TaskExecutionOptions options) - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <typeparam name="T"></typeparam> - void QueueScheduledTask<T>() - where T : IScheduledTask; - - void QueueIfNotRunning<T>() - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <param name="task">The task.</param> - /// <param name="options">The task run options.</param> - void QueueScheduledTask(IScheduledTask task, TaskExecutionOptions options = null); - - /// <summary> - /// Adds the tasks. - /// </summary> - /// <param name="tasks">The tasks.</param> - void AddTasks(IEnumerable<IScheduledTask> tasks); - - void Cancel(IScheduledTaskWorker task); - Task Execute(IScheduledTaskWorker task, TaskExecutionOptions options = null); - - void Execute<T>() - where T : IScheduledTask; - - event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting; - event EventHandler<TaskCompletionEventArgs> TaskCompleted; - - bool SuspendTriggers { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Common/ScheduledTasks/ITaskTrigger.cs b/MediaBrowser.Common/ScheduledTasks/ITaskTrigger.cs deleted file mode 100644 index d6ca63ad7e..0000000000 --- a/MediaBrowser.Common/ScheduledTasks/ITaskTrigger.cs +++ /dev/null @@ -1,36 +0,0 @@ -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Tasks; -using System; -using MediaBrowser.Model.Logging; - -namespace MediaBrowser.Common.ScheduledTasks -{ - /// <summary> - /// Interface ITaskTrigger - /// </summary> - public interface ITaskTrigger - { - /// <summary> - /// Fires when the trigger condition is satisfied and the task should run - /// </summary> - event EventHandler<GenericEventArgs<TaskExecutionOptions>> Triggered; - - /// <summary> - /// Stars waiting for the trigger action - /// </summary> - void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup); - - /// <summary> - /// Stops waiting for the trigger action - /// </summary> - void Stop(); - - /// <summary> - /// Gets or sets the execution properties of this task. - /// </summary> - /// <value> - /// The execution properties of this task. - /// </value> - TaskExecutionOptions TaskOptions { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs b/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs deleted file mode 100644 index fe45f16213..0000000000 --- a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs +++ /dev/null @@ -1,53 +0,0 @@ -using MediaBrowser.Model.Tasks; -using System; -using System.Linq; - -namespace MediaBrowser.Common.ScheduledTasks -{ - /// <summary> - /// Class ScheduledTaskHelpers - /// </summary> - public static class ScheduledTaskHelpers - { - /// <summary> - /// Gets the task info. - /// </summary> - /// <param name="task">The task.</param> - /// <returns>TaskInfo.</returns> - public static TaskInfo GetTaskInfo(IScheduledTaskWorker task) - { - var isHidden = false; - - var configurableTask = task.ScheduledTask as IConfigurableScheduledTask; - - if (configurableTask != null) - { - isHidden = configurableTask.IsHidden; - } - - string key = task.ScheduledTask.Key; - - var triggers = task.Triggers - .OrderBy(i => i.Type) - .ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday) - .ThenBy(i => i.TimeOfDayTicks ?? 0) - .ToList(); - - return new TaskInfo - { - Name = task.Name, - CurrentProgressPercentage = task.CurrentProgress, - State = task.State, - Id = task.Id, - LastExecutionResult = task.LastExecutionResult, - - Triggers = triggers, - - Description = task.Description, - Category = task.Category, - IsHidden = isHidden, - Key = key - }; - } - } -} diff --git a/MediaBrowser.Common/ScheduledTasks/TaskCompletionEventArgs.cs b/MediaBrowser.Common/ScheduledTasks/TaskCompletionEventArgs.cs deleted file mode 100644 index 2974806d02..0000000000 --- a/MediaBrowser.Common/ScheduledTasks/TaskCompletionEventArgs.cs +++ /dev/null @@ -1,12 +0,0 @@ -using MediaBrowser.Model.Tasks; -using System; - -namespace MediaBrowser.Common.ScheduledTasks -{ - public class TaskCompletionEventArgs : EventArgs - { - public IScheduledTaskWorker Task { get; set; } - - public TaskResult Result { get; set; } - } -} |
