From 21f67e67f6f3392420b11f8c0760ea5a8e7aa1fe Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Mon, 22 May 2017 00:59:06 +0300 Subject: [PATCH] Shutdown in Viewer mode on Exception. --- QuickLook/MainWindowTransparent.xaml.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/QuickLook/MainWindowTransparent.xaml.cs b/QuickLook/MainWindowTransparent.xaml.cs index f5b4118..b50696b 100644 --- a/QuickLook/MainWindowTransparent.xaml.cs +++ b/QuickLook/MainWindowTransparent.xaml.cs @@ -30,7 +30,7 @@ namespace QuickLook BlurWindow.EnableWindowBlur(this); }; - buttonCloseWindow.MouseLeftButtonUp += (sender, e) => Hide(); + buttonCloseWindow.MouseLeftButtonUp += (sender, e) => BeginHide(true); } public ContextObject ContextObject { get; private set; } @@ -85,9 +85,6 @@ namespace QuickLook private new void Hide() { - if (App.RunningAsViewer) - Application.Current.Shutdown(); - UnloadPlugin(); ContextObject.Reset(); @@ -131,8 +128,14 @@ namespace QuickLook throw thrown; } - internal bool BeginHide() + internal bool BeginHide(bool quit = false) { + if (quit && App.RunningAsViewer) + { + Application.Current.Shutdown(); + return true; + } + if (Visibility != Visibility.Visible) return false;