// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The Queue Processor // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Services.Queue.Interfaces { using System; using System.ComponentModel; using HandBrakeWPF.Services.Queue.Model; using IEncode = HandBrakeWPF.Services.Encode.Interfaces.IEncode; /// /// The Queue Processor /// public interface IQueueProcessor { #region Events /// /// Fires when the Queue has started /// event QueueProcessor.QueueProgressStatus JobProcessingStarted; /// /// Fires when a job is Added, Removed or Re-Ordered. /// Should be used for triggering an update of the Queue Window. /// event EventHandler QueueChanged; /// /// Fires when the entire encode queue has completed. /// event QueueProcessor.QueueCompletedEventDelegate QueueCompleted; /// /// Fires when a pause to the encode queue has been requested. /// event EventHandler QueuePaused; /// /// Low Diskspace has been detected. /// Checked before each job starts. /// event EventHandler LowDiskspaceDetected; #endregion #region Properties /// /// Gets the number of jobs in the queue /// int Count { get; } /// /// Gets the number of errors detected in the queue. /// int ErrorCount { get; } /// /// Gets the IEncodeService instance. /// IEncode EncodeService { get; } /// /// Gets a value indicating whether IsProcessing. /// bool IsProcessing { get; } /// /// Gets or sets Last Processed Job. /// This is set when the job is poped of the queue by GetNextJobForProcessing(); /// QueueTask LastProcessedJob { get; set; } /// /// Gets The current queue. /// BindingList Queue { get; } #endregion #region Public Methods /// /// Add a job to the Queue. /// This method is Thread Safe. /// /// /// The encode Job object. /// void Add(QueueTask job); /// /// Backup any changes to the queue file /// /// /// If this is not null or empty, this will be used instead of the standard backup location. /// void BackupQueue(string exportPath); /// /// Export the Queue the standardised JSON format. /// /// /// The export path. /// void ExportJson(string exportPath); /// /// Checks the current queue for an existing instance of the specified destination. /// /// /// The destination of the encode. /// /// /// Whether or not the supplied destination is already in the queue. /// bool CheckForDestinationPathDuplicates(string destination); /// /// Clear down all Queue Items /// void Clear(); /// /// Clear down the Queue´s completed items /// void ClearCompleted(); /// /// Get the first job on the queue for processing. /// This also removes the job from the Queue and sets the LastProcessedJob /// /// /// An encode Job object. /// QueueTask GetNextJobForProcessing(); /// /// Moves an item down one position in the queue. /// /// /// The zero-based location of the job in the queue. /// void MoveDown(int index); /// /// Moves an item up one position in the queue. /// /// /// The zero-based location of the job in the queue. /// void MoveUp(int index); /// /// Requests a pause of the encode queue. /// void Pause(); /// /// Remove a job from the Queue. /// This method is Thread Safe /// /// /// The job. /// void Remove(QueueTask job); /// /// Reset a Queued Item from Error or Completed to Waiting /// /// /// The job. /// void ResetJobStatusToWaiting(QueueTask job); /// /// Restore a Queue from file or from the queue backup file. /// /// /// The import path. String.Empty or null will result in the default file being loaded. /// void RestoreQueue(string importPath); /// /// Starts encoding the first job in the queue and continues encoding until all jobs /// have been encoded. /// /// /// The clear Completed. /// void Start(bool clearCompleted); #endregion } }