summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs7
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs5
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs41
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml19
8 files changed, 98 insertions, 1 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
index 32dc494d7..f5aba636c 100644
--- a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
@@ -104,6 +104,11 @@ namespace HandBrake.ApplicationServices.Isolation
}
/// <summary>
+ /// Gets or sets IsPaused
+ /// </summary>
+ public bool IsPasued { get; private set; }
+
+ /// <summary>
/// Gets a value indicating whether IsEncoding.
/// </summary>
public bool IsEncoding
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 42b066ee1..18d69c06f 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -68,6 +68,11 @@ namespace HandBrake.ApplicationServices.Services
}
}
+ /// <summary>
+ /// Gets or sets IsPaused
+ /// </summary>
+ public bool IsPasued { get; private set; }
+
#endregion
#region Public Methods
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
index 61c99eab0..7378eee1d 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
@@ -77,6 +77,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
bool CanPause { get; }
/// <summary>
+ /// Is Paused
+ /// </summary>
+ bool IsPasued { get; }
+
+ /// <summary>
/// Start with a LibHb EncodeJob Object
/// </summary>
/// <param name="job">
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 27e3b039d..608fd1476 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -79,6 +79,11 @@ namespace HandBrake.ApplicationServices.Services
}
/// <summary>
+ /// Gets or sets IsPaused
+ /// </summary>
+ public bool IsPasued { get; private set; }
+
+ /// <summary>
/// Start with a LibHb EncodeJob Object
/// </summary>
/// <param name="job">
@@ -148,6 +153,7 @@ namespace HandBrake.ApplicationServices.Services
if (this.instance != null)
{
this.instance.PauseEncode();
+ this.IsPasued = true;
}
}
@@ -159,6 +165,7 @@ namespace HandBrake.ApplicationServices.Services
if (this.instance != null)
{
this.instance.ResumeEncode();
+ this.IsPasued = false;
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index fd08f6408..b5b8983ea 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -447,6 +447,11 @@ namespace HandBrake.ApplicationServices.Services
this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
this.EncodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
+ if (this.EncodeService.CanPause && this.EncodeService.IsEncoding)
+ {
+ this.EncodeService.Resume();
+ }
+
if (!this.EncodeService.IsEncoding)
{
this.ProcessNextJob();
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>