summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs34
1 files changed, 33 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index c837627c4..8f643a74b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -95,6 +95,11 @@ namespace HandBrakeWPF.ViewModels
private readonly IEncodeServiceWrapper encodeService;
/// <summary>
+ /// Windows 7 API Pack wrapper
+ /// </summary>
+ private readonly Win7 windowsSeven = new Win7();
+
+ /// <summary>
/// HandBrakes Main Window Title
/// </summary>
private string windowName;
@@ -163,6 +168,11 @@ namespace HandBrakeWPF.ViewModels
/// The Source Menu Backing Field
/// </summary>
private IEnumerable<SourceMenuItem> sourceMenu;
+
+ /// <summary>
+ /// The last percentage complete value.
+ /// </summary>
+ private int lastEncodePercentage;
#endregion
/// <summary>
@@ -956,11 +966,15 @@ namespace HandBrakeWPF.ViewModels
if (window != null)
{
+ ILogViewModel logvm = (ILogViewModel)window.DataContext;
+ logvm.SelectedTab = this.IsEncoding ? 0 : 1;
window.Activate();
}
else
{
- this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());
+ ILogViewModel logvm = IoC.Get<ILogViewModel>();
+ logvm.SelectedTab = this.IsEncoding ? 0 : 1;
+ this.WindowManager.ShowWindow(logvm);
}
}
@@ -1782,6 +1796,12 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
{
+ int percent;
+ int.TryParse(
+ Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture),
+ out percent);
+
+
Execute.OnUIThread(
() =>
{
@@ -1796,6 +1816,13 @@ namespace HandBrakeWPF.ViewModels
e.EstimatedTimeLeft,
e.ElapsedTime,
this.queueProcessor.Count);
+
+ if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)
+ {
+ this.windowsSeven.SetTaskBarProgress(percent);
+ }
+
+ lastEncodePercentage = percent;
}
});
}
@@ -1837,6 +1864,11 @@ namespace HandBrakeWPF.ViewModels
{
this.ProgramStatusLabel = "Queue Finished";
this.IsEncoding = false;
+
+ if (this.windowsSeven.IsWindowsSeven)
+ {
+ this.windowsSeven.SetTaskBarProgressToNoProgress();
+ }
});
}