diff options
author | sr55 <[email protected]> | 2012-05-26 02:29:13 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-05-26 02:29:13 +0000 |
commit | cdcf2526b9b85befc27a29431f71c917b59a6f9d (patch) | |
tree | f0b370a5bd21a6fa29eade50396d7302d2bb6f30 /win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | |
parent | 39c79db9e18a6e3c13c8d6818474e8fe74dba2cc (diff) |
WinGui: Improvements and fixes to the Queue Window. Added WhenDone option. Fixed an issue where the progress counter would not display if you started an encode before opening the queue window.
Updated the Options Window to keep settings displayed up to date.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4698 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 79 |
1 files changed, 71 insertions, 8 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index e6e6c8c01..33ad3acf2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -16,6 +16,7 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -39,6 +40,11 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
/// <summary>
+ /// The User Setting Service Backing Field.
+ /// </summary>
+ private readonly IUserSettingService userSettingService;
+
+ /// <summary>
/// Queue Processor Backing field
/// </summary>
private readonly IQueueProcessor queueProcessor;
@@ -58,6 +64,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private string jobsPending;
+ /// <summary>
+ /// Backing field for the when done action description
+ /// </summary>
+ private string whenDoneAction;
+
#endregion
#region Constructors and Destructors
@@ -68,19 +79,23 @@ namespace HandBrakeWPF.ViewModels /// <param name="windowManager">
/// The window manager.
/// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
/// <param name="queueProcessor">
/// The Queue Processor Service
/// </param>
/// <param name="errorService">
/// The Error Service
/// </param>
- public QueueViewModel(IWindowManager windowManager, IQueueProcessor queueProcessor, IErrorService errorService)
+ public QueueViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IQueueProcessor queueProcessor, IErrorService errorService)
{
+ this.userSettingService = userSettingService;
this.queueProcessor = queueProcessor;
this.errorService = errorService;
this.Title = "Queue";
this.JobsPending = "No encodes pending";
- this.JobStatus = "There are no jobs currently encoding";
+ this.JobStatus = "There are no jobs currently encoding";
}
#endregion
@@ -149,11 +164,39 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets WhenDoneAction.
+ /// </summary>
+ public string WhenDoneAction
+ {
+ get
+ {
+ return this.whenDoneAction;
+ }
+ set
+ {
+ this.whenDoneAction = value;
+ this.NotifyOfPropertyChange(() => this.WhenDoneAction);
+ }
+ }
+
#endregion
#region Public Methods
/// <summary>
+ /// Update the When Done Setting
+ /// </summary>
+ /// <param name="action">
+ /// The action.
+ /// </param>
+ public void WhenDone(string action)
+ {
+ this.WhenDoneAction = action;
+ this.userSettingService.SetUserSetting(ASUserSettingConstants.WhenCompleteAction, action);
+ }
+
+ /// <summary>
/// Clear the Queue
/// </summary>
public void Clear()
@@ -182,11 +225,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public override void OnLoad()
{
- this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;
- this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;
- this.queueProcessor.QueuePaused += this.queueProcessor_QueuePaused;
- this.queueProcessor.QueueManager.QueueChanged += this.QueueManager_QueueChanged;
-
// Setup the window to the correct state.
this.IsEncoding = this.queueProcessor.EncodeService.IsEncoding;
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
@@ -291,10 +329,36 @@ namespace HandBrakeWPF.ViewModels protected override void OnActivate()
{
this.Load();
+
+ this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.WhenCompleteAction);
+
+ this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;
+ this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;
+ this.queueProcessor.QueuePaused += this.queueProcessor_QueuePaused;
+ this.queueProcessor.QueueManager.QueueChanged += this.QueueManager_QueueChanged;
+ this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeService_EncodeStatusChanged;
+
base.OnActivate();
}
/// <summary>
+ /// Override the Deactivate
+ /// </summary>
+ /// <param name="close">
+ /// The close.
+ /// </param>
+ protected override void OnDeactivate(bool close)
+ {
+ this.queueProcessor.JobProcessingStarted -= this.queueProcessor_JobProcessingStarted;
+ this.queueProcessor.QueueCompleted -= this.queueProcessor_QueueCompleted;
+ this.queueProcessor.QueuePaused -= this.queueProcessor_QueuePaused;
+ this.queueProcessor.QueueManager.QueueChanged -= this.QueueManager_QueueChanged;
+ this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeService_EncodeStatusChanged;
+
+ base.OnDeactivate(close);
+ }
+
+ /// <summary>
/// Handle the Encode Status Changed Event.
/// </summary>
/// <param name="sender">
@@ -346,7 +410,6 @@ namespace HandBrakeWPF.ViewModels {
this.JobStatus = "Queue Started";
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
- this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeService_EncodeStatusChanged;
this.IsEncoding = true;
}
|