Expose TopMost parameter to outside world

This commit is contained in:
Paddy Xu
2017-06-09 21:26:18 +03:00
parent 689bb33427
commit 1c4d16805f
2 changed files with 4 additions and 7 deletions

View File

@@ -23,10 +23,6 @@ namespace QuickLook
InitializeComponent(); InitializeComponent();
// do not set TopMost property if we are now debugging. it makes debugging painful...
if (!Debugger.IsAttached)
Topmost = true;
SourceInitialized += (sender, e) => SourceInitialized += (sender, e) =>
{ {
if (AllowsTransparency) if (AllowsTransparency)

View File

@@ -158,7 +158,7 @@ namespace QuickLook
} }
} }
internal bool InvokeViewer(string path = null) internal bool InvokeViewer(string path = null, bool topMost = true)
{ {
if (path != null) if (path != null)
_path = path; _path = path;
@@ -172,12 +172,12 @@ namespace QuickLook
var matchedPlugin = PluginManager.GetInstance().FindMatch(_path); var matchedPlugin = PluginManager.GetInstance().FindMatch(_path);
BeginShowNewWindow(matchedPlugin); BeginShowNewWindow(matchedPlugin, topMost);
return true; return true;
} }
private void BeginShowNewWindow(IViewer matchedPlugin) private void BeginShowNewWindow(IViewer matchedPlugin, bool topMost = true)
{ {
_currentMainWindow.UnloadPlugin(); _currentMainWindow.UnloadPlugin();
@@ -189,6 +189,7 @@ namespace QuickLook
if (!ReferenceEquals(oldWindow, _currentMainWindow)) if (!ReferenceEquals(oldWindow, _currentMainWindow))
oldWindow.BeginHide(); oldWindow.BeginHide();
_currentMainWindow.Topmost = !Debugger.IsAttached && topMost;
_currentMainWindow.BeginShow(matchedPlugin, _path, CurrentPluginFailed); _currentMainWindow.BeginShow(matchedPlugin, _path, CurrentPluginFailed);
} }