diff options
author | sr55 <[email protected]> | 2017-08-30 20:41:13 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-08-30 20:41:13 +0100 |
commit | 5d3690d0b58be16a1228984968deb48afd7d1621 (patch) | |
tree | 386273cb64e180291e7699815b3eded954ce9319 /win/CS/HandBrakeWPF/Services/Queue/Model | |
parent | 6336b87579ad3cb913488a2dd1cbacb0af862966 (diff) |
WinGui: Putting paused duration infrastructure in place
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Queue/Model')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs index 857feb924..d12c99059 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs @@ -16,13 +16,14 @@ namespace HandBrakeWPF.Services.Queue.Model public class QueueStats : PropertyChangedBase { private DateTime startTime; - private DateTime endTime; - private long? finalFileSize; + private DateTime pausedStartPoint; + private TimeSpan pausedTimespan; public QueueStats() { + this.pausedTimespan = new TimeSpan(); } public DateTime StartTime @@ -55,12 +56,19 @@ namespace HandBrakeWPF.Services.Queue.Model } } + public TimeSpan PausedDuration + { + get + { + return this.pausedTimespan; + } + } + public TimeSpan Duration { get { - // TODO, take into account Paused Duration. Requires some refactoring first. - return this.EndTime - this.StartTime; + return this.EndTime - this.StartTime - this.PausedDuration; } } @@ -96,5 +104,18 @@ namespace HandBrakeWPF.Services.Queue.Model } public string CompletedActivityLogPath { get; set; } + + public void SetPaused(bool isPaused) + { + if (isPaused) + { + this.pausedStartPoint = DateTime.Now; + } + else + { + TimeSpan pausedDuration = DateTime.Now - this.pausedStartPoint; + this.pausedTimespan = this.PausedDuration.Add(pausedDuration); + } + } } } |