diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 77bade7005..4a17a2fe1e 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -60,10 +60,7 @@ namespace Wox AutoStartup(); AutoUpdates(); - if (!_settings.HideOnStartup) - { - mainVM.MainWindowVisibility = Visibility.Visible; - } + mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible; }); } @@ -102,7 +99,7 @@ namespace Wox } /// - /// let exception throw as normal is better for Debug + /// let exception throw as normal is better for Debug /// [Conditional("RELEASE")] private void RegisterDispatcherUnhandledException() @@ -113,7 +110,7 @@ namespace Wox /// - /// let exception throw as normal is better for Debug + /// let exception throw as normal is better for Debug /// [Conditional("RELEASE")] private static void RegisterAppDomainExceptions() diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index 3412cd0ac3..5106b8b9bb 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -17,6 +17,7 @@ Icon="Images\app.png" AllowsTransparency="True" Loaded="OnLoaded" + Initialized="OnInitialized" Closing="OnClosing" Drop="OnDrop" SizeChanged="OnSizeChanged" diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 1a130c71ba..de56fa027a 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -46,11 +46,16 @@ namespace Wox _viewModel.Save(); } + private void OnInitialized(object sender, EventArgs e) + { + // show notify icon when wox is hided + InitializeNotifyIcon(); + } + private void OnLoaded(object sender, RoutedEventArgs _) { WindowIntelopHelper.DisableControlBox(this); ThemeManager.Instance.ChangeTheme(_settings.Theme); - InitializeNotifyIcon(); InitProgressbarAnimation(); _viewModel.PropertyChanged += (o, e) =>