diff options
author | sr55 <[email protected]> | 2017-08-18 20:39:51 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-08-18 20:45:33 +0100 |
commit | a5d09db0caec7c880e9b280d72a2fafeb122815b (patch) | |
tree | f9b3deb3456eff6065a51328f8ae5036e4a981ac | |
parent | b3b26dfbd1e0ad6d24e7ff823fbd45eb1ffb2428 (diff) |
WinGui: Give the QueueTask object a distinct surrogate key #854
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs | 77 |
1 files changed, 18 insertions, 59 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs index e8813930d..28e66ba59 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs @@ -20,15 +20,9 @@ namespace HandBrakeWPF.Services.Queue.Model /// </summary>
public class QueueTask : PropertyChangedBase
{
- #region Constants and Fields
-
- /// <summary>
- /// The status.
- /// </summary>
+ private static int id = 0;
private QueueItemStatus status;
- #endregion
-
#region Properties
/// <summary>
@@ -37,6 +31,8 @@ namespace HandBrakeWPF.Services.Queue.Model public QueueTask()
{
this.Status = QueueItemStatus.Waiting;
+ id = id + 1;
+ this.Id = id;
}
/// <summary>
@@ -57,12 +53,17 @@ namespace HandBrakeWPF.Services.Queue.Model this.Configuration = configuration;
this.Status = QueueItemStatus.Waiting;
this.ScannedSourcePath = scannedSourcePath;
+
+ id = id + 1;
+ this.Id = id;
}
+ public int Id { get; private set; }
+
/// <summary>
/// Gets or sets ScannedSource.
/// </summary>
- public string ScannedSourcePath { get; set; }
+ public string ScannedSourcePath { get; set; }
/// <summary>
/// Gets or sets Status.
@@ -93,64 +94,22 @@ namespace HandBrakeWPF.Services.Queue.Model #endregion
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="obj">
- /// The obj.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- public override bool Equals(object obj)
+ protected bool Equals(QueueTask other)
{
- if (ReferenceEquals(null, obj))
- {
- return false;
- }
-
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
-
- if (obj.GetType() != this.GetType())
- {
- return false;
- }
-
- return this.Equals((QueueTask)obj);
+ return this.Id == other.Id;
}
- /// <summary>
- /// The get hash code.
- /// </summary>
- /// <returns>
- /// The <see cref="int"/>.
- /// </returns>
- public override int GetHashCode()
+ public override bool Equals(object obj)
{
- unchecked
- {
- int hashCode = (this.ScannedSourcePath != null ? this.ScannedSourcePath.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (int)this.status;
- return hashCode;
- }
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((QueueTask)obj);
}
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(QueueTask other)
+ public override int GetHashCode()
{
- return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;
+ return this.Id;
}
}
}
\ No newline at end of file |