From 27dde4e70d538ec6b7851a5bbc127f6877cd3e7e Mon Sep 17 00:00:00 2001 From: Yeechan Lu Date: Thu, 20 Mar 2014 02:02:18 +0800 Subject: [PATCH] Fix #49. Alt + F4 will hide app now rather than crash --- Wox/MainWindow.xaml.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index a0453da390..f2aa51ab61 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -71,6 +71,14 @@ namespace Wox SetCustomPluginHotkey(); globalHotkey.hookedKeyboardCallback += KListener_hookedKeyboardCallback; + + this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); + } + + void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + this.HideWox(); + e.Cancel = true; } private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)