diff options
author | sr55 <[email protected]> | 2014-05-14 19:48:54 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-05-14 19:48:54 +0000 |
commit | 37848c2b97eda7b116a79d1b520377bd4978e6ba (patch) | |
tree | eb4938c6d839ce87b20a5acf60e02fdf2b13be70 /win/CS/HandBrakeWPF | |
parent | ebb2651ca57744741810e870e3762f1ada2959e6 (diff) |
WinGui: Fix up Pausing when using libhb encode.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6189 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs | 12 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 41 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 19 |
3 files changed, 71 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs index b8d715ede..ca71c7a30 100644 --- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs +++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs @@ -12,6 +12,7 @@ namespace HandBrakeWPF.Services
{
using System;
+ using System.Windows.Forms;
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Isolation;
@@ -145,6 +146,17 @@ namespace HandBrakeWPF.Services }
/// <summary>
+ /// Gets or sets IsPaused
+ /// </summary>
+ public bool IsPasued
+ {
+ get
+ {
+ return this.encodeService.IsPasued;
+ }
+ }
+
+ /// <summary>
/// Gets a value indicating whether IsEncoding.
/// </summary>
public bool IsEncoding
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 55694dbe6..4445a546b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -27,6 +27,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Model.Subtitle;
using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -180,6 +181,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private BindingList<SourceMenuItem> drives;
+ /// <summary>
+ /// The can pause.
+ /// </summary>
+ private bool canPause;
+
#endregion
/// <summary>
@@ -420,6 +426,26 @@ namespace HandBrakeWPF.ViewModels public int TitleSpecificScan { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether the encode serivce supports pausing.
+ /// </summary>
+ public bool CanPause
+ {
+ get
+ {
+ return this.canPause;
+ }
+ set
+ {
+ if (value.Equals(this.canPause))
+ {
+ return;
+ }
+ this.canPause = value;
+ this.NotifyOfPropertyChange(() => this.CanPause);
+ }
+ }
+
+ /// <summary>
/// Gets or sets the Source Label
/// This indicates the status of scans.
/// </summary>
@@ -569,6 +595,7 @@ namespace HandBrakeWPF.ViewModels set
{
this.isEncoding = value;
+ this.CanPause = value;
this.NotifyOfPropertyChange(() => this.IsEncoding);
}
}
@@ -1320,8 +1347,13 @@ namespace HandBrakeWPF.ViewModels }
// Check if we already have jobs, and if we do, just start the queue.
- if (this.queueProcessor.Count != 0)
+ if (this.queueProcessor.Count != 0 || this.encodeService.IsPasued)
{
+ if (this.encodeService.IsPasued)
+ {
+ this.IsEncoding = true;
+ }
+
this.queueProcessor.Start(UserSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue));
return;
}
@@ -1375,6 +1407,12 @@ namespace HandBrakeWPF.ViewModels public void PauseEncode()
{
this.queueProcessor.Pause();
+
+ if (this.encodeService.CanPause)
+ {
+ this.encodeService.Pause();
+ this.IsEncoding = false;
+ }
}
/// <summary>
@@ -2064,6 +2102,7 @@ namespace HandBrakeWPF.ViewModels {
this.IsEncoding = false;
+
Execute.OnUIThread(
() =>
{
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 727a3b36f..15452b201 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -232,6 +232,25 @@ </StackPanel>
</Button>
+ <Button Name="Pause"
+ Micro:Message.Attach="[Event Click] = [Action PauseEncode]"
+ Visibility="{Binding CanPause,
+ Converter={StaticResource boolToVisConverter},
+ ConverterParameter=false}"
+ >
+ <StackPanel Orientation="Horizontal">
+ <Image Width="32"
+ Height="32"
+ SnapsToDevicePixels="True"
+ Source="Images/Pause.png"
+ />
+ <Label Margin="8,0,0,0"
+ VerticalAlignment="Center"
+ Content="Pause"
+ />
+ </StackPanel>
+ </Button>
+
<Menu Background="Transparent">
<MenuItem>
<MenuItem.Header>
|