summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-08-30 20:41:13 +0100
committersr55 <[email protected]>2017-08-30 20:41:13 +0100
commit5d3690d0b58be16a1228984968deb48afd7d1621 (patch)
tree386273cb64e180291e7699815b3eded954ce9319 /win
parent6336b87579ad3cb913488a2dd1cbacb0af862966 (diff)
WinGui: Putting paused duration infrastructure in place
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs29
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs2
2 files changed, 27 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);
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
index 614d36eb3..634ec69e5 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs
@@ -470,6 +470,7 @@ namespace HandBrakeWPF.Services.Queue
if (this.EncodeService.IsEncoding && !this.EncodeService.IsPasued)
{
this.EncodeService.Pause();
+ this.LastProcessedJob.Statistics.SetPaused(true);
}
this.Pause();
@@ -499,6 +500,7 @@ namespace HandBrakeWPF.Services.Queue
this.EncodeService.Resume();
this.IsProcessing = true;
this.InvokeJobProcessingStarted(new QueueProgressEventArgs(this.LastProcessedJob));
+ this.LastProcessedJob.Statistics.SetPaused(false);
}
if (!this.EncodeService.IsEncoding)