From 87497d2d09dedca0c92c58df07147adfdd9dafe5 Mon Sep 17 00:00:00 2001 From: xzhao Date: Sat, 14 May 2016 21:48:58 +0800 Subject: [PATCH] Fixed #586 - add option to hide main window on startup - Fixed #586 --- Wox.Core/UserSettings/Settings.cs | 1 + Wox/Languages/en.xaml | 1 + Wox/Languages/zh-cn.xaml | 1 + Wox/MainWindow.xaml.cs | 2 +- Wox/SettingWindow.xaml | 3 +++ Wox/SettingWindow.xaml.cs | 11 +++++++++++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Wox.Core/UserSettings/Settings.cs b/Wox.Core/UserSettings/Settings.cs index e7b2c8b0e4..37b5f28fb1 100644 --- a/Wox.Core/UserSettings/Settings.cs +++ b/Wox.Core/UserSettings/Settings.cs @@ -44,6 +44,7 @@ namespace Wox.Core.UserSettings public bool EnableUpdateLog { get; set; } public bool StartWoxOnSystemStartup { get; set; } + public bool HideOnStartup { get; set; } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactive { get; set; } public bool RememberLastLaunchLocation { get; set; } diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index ead825b99a..33f1c97989 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -18,6 +18,7 @@ Wox Settings General Start Wox on system startup + Hide Wox on startup Hide Wox when loses focus Don't show upgrade msg if new version available Remember last launch location diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 61bbb1be78..c8a68c7e02 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -18,6 +18,7 @@ Wox设置 通用 开机启动 + 启动时不显示主窗口 失去焦点时自动隐藏Wox 不显示新版本提示 记住上次启动位置 diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 0d8c061e3b..1e8f99f339 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -65,7 +65,7 @@ namespace Wox // happlebao todo delete vm.Left = GetWindowsLeft(); vm.Top = GetWindowsTop(); - vm.MainWindowVisibility = Visibility.Visible; + vm.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible; } private void RegisterEvents(MainViewModel vm) diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 5decc31328..e4866e2256 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -25,6 +25,9 @@ Checked="CbStartWithWindows_OnChecked" Margin="10"> + + + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index e0a1df8da1..30db56d910 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -54,6 +54,16 @@ namespace Wox { #region General + cbHideOnStartup.Checked += (o, e) => + { + _settings.HideOnStartup = true; + }; + + cbHideOnStartup.Unchecked += (o, e) => + { + _settings.HideOnStartup = false; + }; + cbHideWhenDeactive.Checked += (o, e) => { _settings.HideWhenDeactive = true; @@ -114,6 +124,7 @@ namespace Wox //MainWindow.pnlResult.lbResults.GetBindingExpression(MaxHeightProperty).UpdateTarget(); }; + cbHideOnStartup.IsChecked = _settings.HideOnStartup; cbHideWhenDeactive.IsChecked = _settings.HideWhenDeactive; cbDontPromptUpdateMsg.IsChecked = _settings.DontPromptUpdateMsg; cbRememberLastLocation.IsChecked = _settings.RememberLastLaunchLocation;