diff options
author | sr55 <[email protected]> | 2020-07-24 22:02:50 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2020-07-24 22:02:50 +0100 |
commit | 2974cc767def7a4651fcd1b5922730c02af0d1bb (patch) | |
tree | 507248a20c63980c96d6c9e895924617fc769553 /win/CS/HandBrakeWPF/ViewModels | |
parent | 88a5af3e108e1839ec86c7a08d77f13a9e45f6ed (diff) |
WinGui: Add back lost functionality on the new queue design. There is now a Stop button that allows for existing jobs to be completed before stopping the queue. When done action will also be honoured. #2974
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 43 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs | 3 |
3 files changed, 46 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 1d013bd26..c93f0005e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -978,7 +978,7 @@ namespace HandBrakeWPF.ViewModels public void Shutdown()
{
// Shutdown Service
- this.queueProcessor.Stop();
+ this.queueProcessor.Stop(true);
this.presetService.SaveCategoryStates();
// Unsubscribe from Events.
@@ -1388,7 +1388,7 @@ namespace HandBrakeWPF.ViewModels public void PauseEncode()
{
- this.queueProcessor.Pause();
+ this.queueProcessor.Pause(true);
this.NotifyOfPropertyChange(() => this.IsEncoding);
}
@@ -1402,7 +1402,7 @@ namespace HandBrakeWPF.ViewModels if (result == MessageBoxResult.Yes)
{
- this.queueProcessor.Stop();
+ this.queueProcessor.Stop(true);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 67e0c3804..ccb79faad 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -227,17 +227,57 @@ namespace HandBrakeWPF.ViewModels public void PauseQueue()
{
- this.queueProcessor.Pause();
+ this.queueProcessor.Pause(true);
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = false;
}
+ public void PauseJob(QueueTask task)
+ {
+ if (task != null)
+ {
+ this.queueProcessor.Pause(task);
+ }
+ }
+
public void PauseQueueToolbar()
{
this.PauseQueue();
}
+ public void StopQueue()
+ {
+ if (this.queueProcessor.IsEncoding)
+ {
+ MessageBoxResult result = this.errorService.ShowMessageBox(
+ "There are currently jobs running. Would you like to complete the current jobs before stopping the queue?",
+ "Confirm",
+ MessageBoxButton.YesNoCancel,
+ MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.Yes)
+ {
+ this.queueProcessor.Stop(false);
+ }
+ else if (result == MessageBoxResult.Cancel)
+ {
+ return;
+ }
+ else
+ {
+ this.queueProcessor.Stop(true);
+ }
+ }
+ else
+ {
+ this.queueProcessor.Stop(true);
+ }
+
+ this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
+ this.IsQueueRunning = false;
+ }
+
public void RemoveSelectedJobs()
{
if (this.SelectedItems.Count == 0)
@@ -286,7 +326,6 @@ namespace HandBrakeWPF.ViewModels if (result == MessageBoxResult.Yes)
{
- this.queueProcessor.Stop();
this.queueProcessor.Remove(task);
removed = true;
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index 56d8f719f..3e38a35eb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -201,11 +201,12 @@ namespace HandBrakeWPF.ViewModels if (result == MessageBoxResult.Yes)
{
- processor.Stop();
+ processor.Stop(true);
this.MainViewModel?.Shutdown();
return true;
}
+
return false;
}
|