Shutdown in Viewer mode on Exception.

This commit is contained in:
Paddy Xu
2017-05-22 00:59:06 +03:00
parent 2af8d4c4ca
commit 21f67e67f6

View File

@@ -30,7 +30,7 @@ namespace QuickLook
BlurWindow.EnableWindowBlur(this); BlurWindow.EnableWindowBlur(this);
}; };
buttonCloseWindow.MouseLeftButtonUp += (sender, e) => Hide(); buttonCloseWindow.MouseLeftButtonUp += (sender, e) => BeginHide(true);
} }
public ContextObject ContextObject { get; private set; } public ContextObject ContextObject { get; private set; }
@@ -85,9 +85,6 @@ namespace QuickLook
private new void Hide() private new void Hide()
{ {
if (App.RunningAsViewer)
Application.Current.Shutdown();
UnloadPlugin(); UnloadPlugin();
ContextObject.Reset(); ContextObject.Reset();
@@ -131,8 +128,14 @@ namespace QuickLook
throw thrown; throw thrown;
} }
internal bool BeginHide() internal bool BeginHide(bool quit = false)
{ {
if (quit && App.RunningAsViewer)
{
Application.Current.Shutdown();
return true;
}
if (Visibility != Visibility.Visible) if (Visibility != Visibility.Visible)
return false; return false;