summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs74
1 files changed, 35 insertions, 39 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
index faa856d6b..3465fe273 100644
--- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -237,6 +237,13 @@ namespace HandBrakeWPF.ViewModels
public void PauseEncode()
{
this.queueProcessor.Pause();
+
+ this.JobStatus = "Queue Paused";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.IsEncoding = false;
+
+ MessageBox.Show("The Queue has been pasued. The currently running job will run to completion and no further jobs will start.", "Queue",
+ MessageBoxButton.OK, MessageBoxImage.Information);
}
/// <summary>
@@ -293,6 +300,10 @@ namespace HandBrakeWPF.ViewModels
return;
}
+ this.JobStatus = "Queue Started";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.IsEncoding = true;
+
this.queueProcessor.Start();
}
@@ -364,13 +375,13 @@ namespace HandBrakeWPF.ViewModels
this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
- this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;
this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;
- this.queueProcessor.QueuePaused += this.queueProcessor_QueuePaused;
this.queueProcessor.QueueChanged += this.QueueManager_QueueChanged;
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeService_EncodeStatusChanged;
+ this.queueProcessor.EncodeService.EncodeCompleted += EncodeService_EncodeCompleted;
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.JobStatus = "Queue Ready";
base.OnActivate();
}
@@ -383,11 +394,10 @@ namespace HandBrakeWPF.ViewModels
/// </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.QueueChanged -= this.QueueManager_QueueChanged;
this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeService_EncodeStatusChanged;
+ this.queueProcessor.EncodeService.EncodeCompleted -= EncodeService_EncodeCompleted;
base.OnDeactivate(close);
}
@@ -406,19 +416,16 @@ namespace HandBrakeWPF.ViewModels
{
Caliburn.Micro.Execute.OnUIThread(() =>
{
- if (this.IsEncoding)
- {
- this.JobStatus =
- string.Format(
- "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
- e.Task,
- e.TaskCount,
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
- e.ElapsedTime);
- }
+ this.JobStatus =
+ string.Format(
+ "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
+ e.Task,
+ e.TaskCount,
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
+ e.ElapsedTime);
});
}
@@ -434,23 +441,11 @@ namespace HandBrakeWPF.ViewModels
private void QueueManager_QueueChanged(object sender, EventArgs e)
{
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- }
- /// <summary>
- /// Handle teh Job Processing Started Event
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The QueueProgressEventArgs.
- /// </param>
- private void queueProcessor_JobProcessingStarted(
- object sender, QueueProgressEventArgs e)
- {
- this.JobStatus = "Queue Started";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- this.IsEncoding = true;
+ if (!queueProcessor.IsProcessing)
+ {
+ this.JobStatus = "Queue Not Running";
+ }
}
/// <summary>
@@ -470,19 +465,20 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Handle the Queue Paused Event
+ /// The encode service_ encode completed.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The EventArgs.
+ /// The e.
/// </param>
- private void queueProcessor_QueuePaused(object sender, EventArgs e)
+ private void EncodeService_EncodeCompleted(object sender, EncodeCompletedEventArgs e)
{
- this.JobStatus = "Queue Paused";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- this.IsEncoding = false;
+ if (!this.queueProcessor.IsProcessing)
+ {
+ this.JobStatus = "Last Queued Job Finished";
+ }
}
#endregion