diff --git a/IdeapadToolkit/App.config b/IdeapadToolkit/App.config index 8b5e25b..c12e4d5 100644 --- a/IdeapadToolkit/App.config +++ b/IdeapadToolkit/App.config @@ -10,6 +10,9 @@ + + True + \ No newline at end of file diff --git a/IdeapadToolkit/Localization/Strings.Designer.cs b/IdeapadToolkit/Localization/Strings.Designer.cs index 1d891d9..0d5cf7a 100644 --- a/IdeapadToolkit/Localization/Strings.Designer.cs +++ b/IdeapadToolkit/Localization/Strings.Designer.cs @@ -159,6 +159,15 @@ public static string INTELLIGENT_COOLING { } } + /// + /// Looks up a localized string similar to Keep running in the background. + /// + public static string KEEP_IN_TRAY { + get { + return ResourceManager.GetString("KEEP_IN_TRAY", resourceCulture); + } + } + /// /// Looks up a localized string similar to Language. /// diff --git a/IdeapadToolkit/Localization/Strings.cs-CZ.resx b/IdeapadToolkit/Localization/Strings.cs-CZ.resx index 0b50758..c7a7269 100644 --- a/IdeapadToolkit/Localization/Strings.cs-CZ.resx +++ b/IdeapadToolkit/Localization/Strings.cs-CZ.resx @@ -168,4 +168,7 @@ Spustit při startu + + Ponechat spuštěné na pozadí + \ No newline at end of file diff --git a/IdeapadToolkit/Localization/Strings.fr-FR.resx b/IdeapadToolkit/Localization/Strings.fr-FR.resx index eb18cef..0ef53e6 100644 --- a/IdeapadToolkit/Localization/Strings.fr-FR.resx +++ b/IdeapadToolkit/Localization/Strings.fr-FR.resx @@ -168,4 +168,7 @@ Lancer au démarrage - + + Laisser en cours d'exécution en arrière-plan + + \ No newline at end of file diff --git a/IdeapadToolkit/Localization/Strings.resx b/IdeapadToolkit/Localization/Strings.resx index 7011648..fcc272b 100644 --- a/IdeapadToolkit/Localization/Strings.resx +++ b/IdeapadToolkit/Localization/Strings.resx @@ -168,4 +168,7 @@ Run On Startup + + Keep running in the background + \ No newline at end of file diff --git a/IdeapadToolkit/Localization/Strings.zh-CN.resx b/IdeapadToolkit/Localization/Strings.zh-CN.resx index db42417..4d92bd4 100644 --- a/IdeapadToolkit/Localization/Strings.zh-CN.resx +++ b/IdeapadToolkit/Localization/Strings.zh-CN.resx @@ -168,4 +168,7 @@ 开机时自动启动 + + 在后台运行 + \ No newline at end of file diff --git a/IdeapadToolkit/MainWindow.xaml b/IdeapadToolkit/MainWindow.xaml index cd04160..ddb2a1b 100644 --- a/IdeapadToolkit/MainWindow.xaml +++ b/IdeapadToolkit/MainWindow.xaml @@ -20,6 +20,7 @@ ui:TitleBar.Style="{DynamicResource TitleBarStyle}" ui:WindowHelper.UseModernWindowStyle="True" Background="#0b0b0b" + Closing="_mainwindow_Closing" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/IdeapadToolkit/MainWindow.xaml.cs b/IdeapadToolkit/MainWindow.xaml.cs index 1f07ed7..52123cc 100644 --- a/IdeapadToolkit/MainWindow.xaml.cs +++ b/IdeapadToolkit/MainWindow.xaml.cs @@ -35,5 +35,13 @@ private void NavigationView_ItemInvoked(ModernWpf.Controls.NavigationView sender } } } + + private void _mainwindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + if (!Settings.Default.KeepInTray) + { + Application.Current.Shutdown(); + } + } } } diff --git a/IdeapadToolkit/Settings.Designer.cs b/IdeapadToolkit/Settings.Designer.cs index 8475400..4a1d33e 100644 --- a/IdeapadToolkit/Settings.Designer.cs +++ b/IdeapadToolkit/Settings.Designer.cs @@ -34,5 +34,17 @@ public string Language { this["Language"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool KeepInTray { + get { + return ((bool)(this["KeepInTray"])); + } + set { + this["KeepInTray"] = value; + } + } } } diff --git a/IdeapadToolkit/Settings.settings b/IdeapadToolkit/Settings.settings index e228e62..2beb359 100644 --- a/IdeapadToolkit/Settings.settings +++ b/IdeapadToolkit/Settings.settings @@ -5,5 +5,8 @@ + + True + \ No newline at end of file diff --git a/IdeapadToolkit/ViewModels/SettingsViewModel.cs b/IdeapadToolkit/ViewModels/SettingsViewModel.cs index 0553c2e..4a0c187 100644 --- a/IdeapadToolkit/ViewModels/SettingsViewModel.cs +++ b/IdeapadToolkit/ViewModels/SettingsViewModel.cs @@ -73,5 +73,15 @@ public Locale SelectedLocale Settings.Default.Save(); } } + + public bool KeepInTray + { + get => Settings.Default.KeepInTray; + set + { + Settings.Default.KeepInTray = value; + Settings.Default.Save(); + } + } } } diff --git a/IdeapadToolkit/Views/SettingsPage.xaml b/IdeapadToolkit/Views/SettingsPage.xaml index cf5baf6..52de7fe 100644 --- a/IdeapadToolkit/Views/SettingsPage.xaml +++ b/IdeapadToolkit/Views/SettingsPage.xaml @@ -14,6 +14,7 @@ +