From 1c4d16805fa6e38eb0d64ef5eee5f18ef86cb121 Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Fri, 9 Jun 2017 21:26:18 +0300 Subject: [PATCH] Expose TopMost parameter to outside world --- QuickLook/MainWindowTransparent.xaml.cs | 4 ---- QuickLook/ViewWindowManager.cs | 7 ++++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/QuickLook/MainWindowTransparent.xaml.cs b/QuickLook/MainWindowTransparent.xaml.cs index f5aa3ac..c0bafdf 100644 --- a/QuickLook/MainWindowTransparent.xaml.cs +++ b/QuickLook/MainWindowTransparent.xaml.cs @@ -23,10 +23,6 @@ namespace QuickLook InitializeComponent(); - // do not set TopMost property if we are now debugging. it makes debugging painful... - if (!Debugger.IsAttached) - Topmost = true; - SourceInitialized += (sender, e) => { if (AllowsTransparency) diff --git a/QuickLook/ViewWindowManager.cs b/QuickLook/ViewWindowManager.cs index 9cd5c10..585d358 100644 --- a/QuickLook/ViewWindowManager.cs +++ b/QuickLook/ViewWindowManager.cs @@ -158,7 +158,7 @@ namespace QuickLook } } - internal bool InvokeViewer(string path = null) + internal bool InvokeViewer(string path = null, bool topMost = true) { if (path != null) _path = path; @@ -172,12 +172,12 @@ namespace QuickLook var matchedPlugin = PluginManager.GetInstance().FindMatch(_path); - BeginShowNewWindow(matchedPlugin); + BeginShowNewWindow(matchedPlugin, topMost); return true; } - private void BeginShowNewWindow(IViewer matchedPlugin) + private void BeginShowNewWindow(IViewer matchedPlugin, bool topMost = true) { _currentMainWindow.UnloadPlugin(); @@ -189,6 +189,7 @@ namespace QuickLook if (!ReferenceEquals(oldWindow, _currentMainWindow)) oldWindow.BeginHide(); + _currentMainWindow.Topmost = !Debugger.IsAttached && topMost; _currentMainWindow.BeginShow(matchedPlugin, _path, CurrentPluginFailed); }