diff --git a/Plugins/Wox.Plugin.Sys/Languages/en.xaml b/Plugins/Wox.Plugin.Sys/Languages/en.xaml index 0d3fb8e61f..daf616989c 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/en.xaml @@ -5,16 +5,20 @@ Command Description + Save Settings + Shutdown Computer Restart Computer Log off Lock this computer Close Wox Restart Wox + Save all Wox settings Tweak this app Put computer to sleep Empty recycle bin + Successfully saved all Wox settings System Commands Provides System related commands. e.g. shutdown, lock, settings etc. diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index 1334034a3b..e9f1b6a271 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -168,6 +168,18 @@ namespace Wox.Plugin.Sys } }, new Result + { + Title = context.API.GetTranslation("wox_plugin_sys_save_command"), + SubTitle = context.API.GetTranslation("wox_plugin_sys_save"), + IcoPath = "Images\\app.png", + Action = c => + { + context.API.SaveAppAllSettings(); + context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_sys_save_success"))); + return true; + } + }, + new Result { Title = "Restart Wox", SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"), diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index c726c962a6..7dcac48440 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -57,6 +57,11 @@ namespace Wox.Plugin [Obsolete] void ShowApp(); + /// + /// Save all Wox settings + /// + void SaveAppAllSettings(); + /// /// Show message box /// diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index 748c7aac65..9c8e7008bd 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -59,13 +59,18 @@ namespace Wox // we must manually save // UpdateManager.RestartApp() will call Environment.Exit(0) // which will cause ungraceful exit + SaveAppAllSettings(); + + UpdateManager.RestartApp(); + } + + public void SaveAppAllSettings() + { _mainVM.Save(); _settingsVM.Save(); PluginManager.Save(); ImageLoader.Save(); Alphabet.Save(); - - UpdateManager.RestartApp(); } [Obsolete]