diff options
author | sr55 <[email protected]> | 2019-07-03 21:19:16 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-07-03 21:23:56 +0100 |
commit | e91ee8d30f0f620fd78bcbb0ca2f2f911a47442f (patch) | |
tree | 4195748ffb0a19b301ab7c35bdf96901121c72f8 /win/CS/HandBrakeWPF/Services/Queue | |
parent | 3ce36a1bfe5ce943a6d5ffb0c4a92d8b2390449f (diff) |
WinGui: Nice display of statistics when information isn't available. #2179
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Queue')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs index 3378bd6aa..781105d8f 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs @@ -13,6 +13,8 @@ namespace HandBrakeWPF.Services.Queue.Model using Caliburn.Micro; + using HandBrakeWPF.Properties; + using Newtonsoft.Json; [JsonObject(MemberSerialization.OptOut)] @@ -35,12 +37,27 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.startTime; } + set { if (value.Equals(this.startTime)) return; this.startTime = value; this.NotifyOfPropertyChange(() => this.StartTime); this.NotifyOfPropertyChange(() => this.Duration); + this.NotifyOfPropertyChange(() => this.StartTimeDisplay); + } + } + + public string StartTimeDisplay + { + get + { + if (this.startTime == DateTime.MinValue) + { + return Resources.QueueView_NotAvailable; + } + + return this.startTime.ToString(); } } @@ -50,12 +67,27 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.endTime; } + set { if (value.Equals(this.endTime)) return; this.endTime = value; this.NotifyOfPropertyChange(() => this.EndTime); this.NotifyOfPropertyChange(() => this.Duration); + this.NotifyOfPropertyChange(() => this.EndTimeDisplay); + } + } + + public string EndTimeDisplay + { + get + { + if (this.endTime == DateTime.MinValue) + { + return Resources.QueueView_NotAvailable; + } + + return this.endTime.ToString(); } } @@ -73,7 +105,7 @@ namespace HandBrakeWPF.Services.Queue.Model { if (this.endTime == DateTime.MinValue) { - return TimeSpan.MinValue; + return TimeSpan.Zero; } return this.EndTime - this.StartTime - this.PausedDuration; @@ -89,6 +121,7 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.finalFileSize; } + set { if (value == this.finalFileSize) return; @@ -125,5 +158,19 @@ namespace HandBrakeWPF.Services.Queue.Model this.pausedTimespan = this.PausedDuration.Add(pausedDuration); } } + + public void Reset() + { + this.StartTime = DateTime.MinValue; + this.EndTime = DateTime.MinValue; + this.FinalFileSize = 0; + this.pausedTimespan = TimeSpan.Zero; + this.pausedStartPoint = DateTime.MinValue; + this.CompletedActivityLogPath = null; + + this.NotifyOfPropertyChange(() => this.FinalFileSizeInMegaBytes); + this.NotifyOfPropertyChange(() => this.PausedDuration); + this.NotifyOfPropertyChange(() => this.Duration); + } } } |