diff options
author | sr55 <[email protected]> | 2013-08-18 20:29:53 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-08-18 20:29:53 +0000 |
commit | f7dd1b81feb1a34e030d47f782bfa017a5550fd1 (patch) | |
tree | 8a7a643fe3f43ad117eed3ccc0ece471f3ed7dc2 | |
parent | 1b762c5dcdab7133e2954fd3bb21e239a74de7e5 (diff) |
WinGui: Stopping an encode or pausing the queue will no longer run the "When Done" option.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5714 b64f7644-9d1e-0410-96f1-a4d463321fa5
5 files changed, 69 insertions, 22 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/QueueCompletedEventArgs.cs b/win/CS/HandBrake.ApplicationServices/EventArgs/QueueCompletedEventArgs.cs new file mode 100644 index 000000000..a98e784c3 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/EventArgs/QueueCompletedEventArgs.cs @@ -0,0 +1,38 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueCompletedEventArgs.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Queue Completed Event Args
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.EventArgs
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Queue Completed Event Args
+ /// </summary>
+ [DataContract]
+ public class QueueCompletedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueCompletedEventArgs"/> class.
+ /// </summary>
+ /// <param name="wasManuallyStopped">
+ /// The was Manually Stopped.
+ /// </param>
+ public QueueCompletedEventArgs(bool wasManuallyStopped)
+ {
+ this.WasManuallyStopped = wasManuallyStopped;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the queue WasManuallyStopped.
+ /// </summary>
+ [DataMember]
+ public bool WasManuallyStopped { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 4888c9e9b..42952d432 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -83,6 +83,7 @@ <ItemGroup>
<Compile Include="Collections\SerializableDictionary.cs" />
<Compile Include="Converters\EnumToDescConverter.cs" />
+ <Compile Include="EventArgs\QueueCompletedEventArgs.cs" />
<Compile Include="EventArgs\SettingChangedEventArgs.cs" />
<Compile Include="Exceptions\GeneralApplicationException.cs" />
<Compile Include="EventArgs\EncodeCompletedEventArgs.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs index b4c8872c0..f1ba5c7fe 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueProcessor.cs @@ -35,7 +35,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces /// <summary>
/// Fires when the entire encode queue has completed.
/// </summary>
- event EventHandler QueueCompleted;
+ event QueueProcessor.QueueCompletedEventDelegate QueueCompleted;
/// <summary>
/// Fires when a pause to the encode queue has been requested.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs index a8cb55f58..92558f6cc 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -49,12 +49,7 @@ namespace HandBrake.ApplicationServices.Services /// <summary>
/// HandBrakes Queue file with a place holder for an extra string.
/// </summary>
- private string queueFile;
-
- /// <summary>
- /// The is paused.
- /// </summary>
- private bool isPaused;
+ private readonly string queueFile;
#endregion
@@ -96,6 +91,17 @@ namespace HandBrake.ApplicationServices.Services /// </param>
public delegate void QueueProgressStatus(object sender, QueueProgressEventArgs e);
+ /// <summary>
+ /// The queue completed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public delegate void QueueCompletedEventDelegate(object sender, QueueCompletedEventArgs e);
+
#endregion
#region Events
@@ -114,7 +120,7 @@ namespace HandBrake.ApplicationServices.Services /// <summary>
/// Fires when the entire encode queue has completed.
/// </summary>
- public event EventHandler QueueCompleted;
+ public event QueueCompletedEventDelegate QueueCompleted;
/// <summary>
/// Fires when a pause to the encode queue has been requested.
@@ -424,7 +430,6 @@ namespace HandBrake.ApplicationServices.Services {
this.InvokeQueuePaused(EventArgs.Empty);
this.IsProcessing = false;
- this.isPaused = true;
}
/// <summary>
@@ -447,7 +452,6 @@ namespace HandBrake.ApplicationServices.Services }
this.IsProcessing = true;
- this.isPaused = false;
}
#endregion
@@ -490,7 +494,7 @@ namespace HandBrake.ApplicationServices.Services else
{
this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
- this.InvokeQueueCompleted(EventArgs.Empty);
+ this.OnQueueCompleted(new QueueCompletedEventArgs(true));
this.BackupQueue(string.Empty);
}
}
@@ -535,16 +539,14 @@ namespace HandBrake.ApplicationServices.Services }
/// <summary>
- /// Invoke the QueueCompleted event.
+ /// Invoke the QueuePaused event
/// </summary>
/// <param name="e">
/// The EventArgs.
/// </param>
- private void InvokeQueueCompleted(EventArgs e)
+ private void InvokeQueuePaused(EventArgs e)
{
- this.IsProcessing = false;
-
- EventHandler handler = this.QueueCompleted;
+ EventHandler handler = this.QueuePaused;
if (handler != null)
{
handler(this, e);
@@ -552,14 +554,14 @@ namespace HandBrake.ApplicationServices.Services }
/// <summary>
- /// Invoke the QueuePaused event
+ /// The on queue completed.
/// </summary>
/// <param name="e">
- /// The EventArgs.
+ /// The e.
/// </param>
- private void InvokeQueuePaused(EventArgs e)
+ protected virtual void OnQueueCompleted(QueueCompletedEventArgs e)
{
- EventHandler handler = this.QueuePaused;
+ QueueCompletedEventDelegate handler = this.QueueCompleted;
if (handler != null)
{
handler(this, e);
@@ -583,7 +585,7 @@ namespace HandBrake.ApplicationServices.Services this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
// Fire the event to tell connected services.
- this.InvokeQueueCompleted(EventArgs.Empty);
+ this.OnQueueCompleted(new QueueCompletedEventArgs(false));
}
}
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs index afc125e99..964e453ad 100644 --- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs +++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.Services using Caliburn.Micro;
+ using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -108,8 +109,13 @@ namespace HandBrakeWPF.Services /// <param name="e">
/// The e.
/// </param>
- private void QueueProcessorQueueCompleted(object sender, System.EventArgs e)
+ private void QueueProcessorQueueCompleted(object sender, QueueCompletedEventArgs e)
{
+ if (e.WasManuallyStopped)
+ {
+ return;
+ }
+
// Do something whent he encode ends.
switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction))
{
|