// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The QueueTask. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Model { using Caliburn.Micro; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Scan.Model; /// /// The QueueTask. /// public class QueueTask : PropertyChangedBase { #region Constants and Fields /// /// The status. /// private QueueItemStatus status; #endregion #region Properties /// /// Initializes a new instance of the class. /// public QueueTask() { this.Status = QueueItemStatus.Waiting; } /// /// Initializes a new instance of the class. /// /// /// The task. /// /// /// The configuration. /// /// /// The scanned Source. /// public QueueTask(EncodeTask task, HBConfiguration configuration, Source scannedSource) { this.Task = task; this.Configuration = configuration; this.Status = QueueItemStatus.Waiting; this.ScannedSource = scannedSource; } /// /// Gets or sets ScannedSource. /// public Source ScannedSource { get; set; } /// /// Gets or sets Status. /// public QueueItemStatus Status { get { return this.status; } set { this.status = value; this.NotifyOfPropertyChange(() => this.Status); } } /// /// Gets or sets the task. /// public EncodeTask Task { get; set; } /// /// Gets or sets the configuration. /// public HBConfiguration Configuration { get; set; } #endregion /// /// The equals. /// /// /// The other. /// /// /// The . /// protected bool Equals(QueueTask other) { return Equals(this.ScannedSource, other.ScannedSource) && Equals(this.Task, other.Task) && this.status == other.status; } /// /// The equals. /// /// /// The obj. /// /// /// The . /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != this.GetType()) { return false; } return Equals((QueueTask)obj); } /// /// The get hash code. /// /// /// The . /// public override int GetHashCode() { unchecked { int hashCode = (this.ScannedSource != null ? this.ScannedSource.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)this.status; return hashCode; } } } }