From: sr55 <sr55.hb@outlook.com>
Date: Fri, 14 Dec 2018 21:00:21 +0000 (+0000)
Subject: WinGui: Focus the preview window when the button is pressed while it is still open.
X-Git-Tag: 1.2.0~8
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d0bd43191921d01b2d4d69fa0b04fecf9c2c555;p=handbrake

WinGui: Focus the preview window when the button is pressed while it is still open.
---

diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index a64e0cb39..367318080 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1463,6 +1463,11 @@ namespace HandBrakeWPF.ViewModels
                 this.StaticPreviewViewModel.UpdatePreviewFrame(this.CurrentTask, this.ScannedSource);
                 this.windowManager.ShowWindow(this.StaticPreviewViewModel);
             }
+            else if (this.StaticPreviewViewModel.IsOpen)
+            {
+                Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(StaticPreviewView));
+                window?.Focus();
+            }
         }
 
         public void ShowPresetPane()