close #65 Hide when app loses focus

This commit is contained in:
qianlifeng
2014-04-13 10:08:33 +08:00
parent 54417115f3
commit 36f3c293f0
5 changed files with 31 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
Loaded="MainWindow_OnLoaded"
SizeToContent="Height"
ResizeMode="NoResize"
Deactivated="MainWindow_OnDeactivated"
WindowStyle="None"
WindowStartupLocation="Manual"
ShowInTaskbar="False"

View File

@@ -299,7 +299,13 @@ namespace Wox
}
}
private void MainWindow_OnDeactivated(object sender, EventArgs e)
{
if (UserSettingStorage.Instance.HideWhenDeactive)
{
HideWox();
}
}
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
{
@@ -554,5 +560,7 @@ namespace Wox
}
return false;
}
}
}

View File

@@ -33,6 +33,10 @@
<CheckBox x:Name="cbLeaveCmdOpen" />
<TextBlock Text="Do not close Command Prompt after command execution" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10">
<CheckBox x:Name="cbHideWhenDeactive" />
<TextBlock Text="Hide Wox when loses focus" />
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="Features">

View File

@@ -87,6 +87,18 @@ namespace Wox
UserSettingStorage.Instance.Save();
};
cbHideWhenDeactive.Checked += (o, e) =>
{
UserSettingStorage.Instance.HideWhenDeactive = true;
UserSettingStorage.Instance.Save();
};
cbHideWhenDeactive.Unchecked += (o, e) =>
{
UserSettingStorage.Instance.HideWhenDeactive = false;
UserSettingStorage.Instance.Save();
};
#region Load Theme Data
if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) &&
@@ -179,6 +191,7 @@ namespace Wox
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
cbEnableBookmarkPlugin.IsChecked = UserSettingStorage.Instance.EnableBookmarkPlugin;
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
var features = new CompositeCollection
{