From: sr55 Date: Mon, 24 Sep 2018 20:07:56 +0000 (+0100) Subject: WinGui: When Deleting a job, select the nearest or first item in the list to allow... X-Git-Tag: 1.2.0~149 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b115733f3a3e898fb53690f8562872bc0e1fe9f5;p=handbrake WinGui: When Deleting a job, select the nearest or first item in the list to allow faster keyboard operations to manage the queue. --- diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 42dc2fef4..9ff7e6b40 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -405,6 +405,9 @@ namespace HandBrakeWPF.ViewModels return; } + bool removed = false; + int index = this.QueueTasks.IndexOf(task); + if (task.Status == QueueItemStatus.InProgress) { MessageBoxResult result = @@ -418,11 +421,18 @@ namespace HandBrakeWPF.ViewModels { this.queueProcessor.EncodeService.Stop(); this.queueProcessor.Remove(task); + removed = true; } } else { this.queueProcessor.Remove(task); + removed = true; + } + + if (this.QueueTasks.Any() && removed) + { + this.SelectedTask = index > 1 ? this.QueueTasks[index - 1] : this.QueueTasks.FirstOrDefault(); } }