namespace HandBrakeWPF.Services.Queue.Model
{
using System;
+ using System.Runtime.CompilerServices;
using Caliburn.Micro;
private DateTime pausedStartPoint;
private TimeSpan pausedTimespan;
+ private bool isPaused;
+
public QueueStats()
{
this.pausedTimespan = new TimeSpan();
set
{
- if (value.Equals(this.startTime)) return;
+ if (value.Equals(this.startTime))
+ {
+ return;
+ }
+
this.startTime = value;
this.NotifyOfPropertyChange(() => this.StartTime);
this.NotifyOfPropertyChange(() => this.Duration);
set
{
- if (value.Equals(this.endTime)) return;
+ if (value.Equals(this.endTime))
+ {
+ return;
+ }
+
this.endTime = value;
this.NotifyOfPropertyChange(() => this.EndTime);
this.NotifyOfPropertyChange(() => this.Duration);
{
if (this.endTime == DateTime.MinValue)
{
- return Resources.QueueView_NotAvailable;
+ return string.Empty;
}
return this.endTime.ToString();
}
}
+ public string PausedDisplay
+ {
+ get
+ {
+ if (this.isPaused)
+ {
+ return Resources.QueueView_CurrentlyPaused;
+ }
+
+ if (this.PausedDuration == TimeSpan.Zero)
+ {
+ return string.Empty;
+ }
+
+ return PausedDuration.ToString("hh\\:mm\\:ss");
+ }
+ }
+
public TimeSpan Duration
{
get
}
}
- /// <summary>
- /// Final filesize in Bytes
- /// </summary>
+ public string DurationDisplay
+ {
+ get
+ {
+ if (this.Duration == TimeSpan.Zero)
+ {
+ return string.Empty;
+ }
+
+ return this.Duration.ToString("hh\\:mm\\:ss");
+ }
+ }
+
public long? FinalFileSize
{
get
set
{
- if (value == this.finalFileSize) return;
+ if (value == this.finalFileSize)
+ {
+ return;
+ }
+
this.finalFileSize = value;
this.NotifyOfPropertyChange(() => this.FinalFileSize);
this.NotifyOfPropertyChange(() => this.FinalFileSizeInMegaBytes);
}
}
+ public string FileSizeDisplay
+ {
+ get
+ {
+ if (FinalFileSizeInMegaBytes == 0)
+ {
+ return string.Empty;
+ }
+
+ return string.Format("{0:##.###} MB", FinalFileSizeInMegaBytes);
+ }
+ }
+
public string CompletedActivityLogPath { get; set; }
public void SetPaused(bool isPaused)
{
+ this.isPaused = isPaused;
if (isPaused)
{
this.pausedStartPoint = DateTime.Now;
TimeSpan pausedDuration = DateTime.Now - this.pausedStartPoint;
this.pausedTimespan = this.PausedDuration.Add(pausedDuration);
}
+
+ this.NotifyOfPropertyChange(() => this.PausedDisplay);
}
public void Reset()
this.NotifyOfPropertyChange(() => this.FinalFileSizeInMegaBytes);
this.NotifyOfPropertyChange(() => this.PausedDuration);
- this.NotifyOfPropertyChange(() => this.Duration);
+ this.NotifyOfPropertyChange(() => this.DurationDisplay);
}
}
}
</Grid.RowDefinitions>\r
\r
<Grid.ColumnDefinitions>\r
- <ColumnDefinition Width="Auto" MinWidth="100" />\r
+ <ColumnDefinition Width="Auto" MinWidth="125" />\r
<ColumnDefinition Width="*" />\r
</Grid.ColumnDefinitions>\r
\r
<TextBlock Text="{Binding SelectedTask.Statistics.EndTimeDisplay}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" />\r
\r
<TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_PausedDuration}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" />\r
- <TextBlock Text="{Binding SelectedTask.Statistics.PausedDuration,StringFormat=hh\\:mm\\:ss}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" />\r
+ <TextBlock Text="{Binding SelectedTask.Statistics.PausedDisplay}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" />\r
\r
<TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Duration}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" />\r
- <TextBlock Text="{Binding SelectedTask.Statistics.Duration,StringFormat=hh\\:mm\\:ss}" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" />\r
+ <TextBlock Text="{Binding SelectedTask.Statistics.DurationDisplay}" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" />\r
\r
<TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_FileSize}" VerticalAlignment="Top" Grid.Row="4" Grid.Column="0" />\r
- <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" >\r
- <TextBlock Text="{Binding SelectedTask.Statistics.FinalFileSizeInMegaBytes}" TextWrapping="Wrap" />\r
- <TextBlock Text=" MB" />\r
- </StackPanel>\r
-\r
+ <TextBlock Text="{Binding SelectedTask.Statistics.FileSizeDisplay}" TextWrapping="Wrap" Grid.Row="4" Grid.Column="1" />\r
</Grid>\r
-\r
</StackPanel>\r
</ScrollViewer>\r
</TabItem>\r