From 5d3690d0b58be16a1228984968deb48afd7d1621 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 30 Aug 2017 20:41:13 +0100 Subject: WinGui: Putting paused duration infrastructure in place --- .../Services/Queue/Model/QueueStats.cs | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'win/CS/HandBrakeWPF/Services/Queue/Model') 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); + } + } } } -- cgit v1.2.3