mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-13 11:09:28 +08:00
Add to Sys plugin- save all Wox settings
This commit is contained in:
parent
dedac39d99
commit
c0c55a7af8
@ -5,16 +5,20 @@
|
||||
<system:String x:Key="wox_plugin_sys_command">Command</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_desc">Description</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_save_command">Save Settings</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_shutdown_computer">Shutdown Computer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart_computer">Restart Computer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_log_off">Log off</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">Lock this computer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">Close Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">Restart Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_save">Save all Wox settings</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">Tweak this app</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">Put computer to sleep</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Empty recycle bin</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_save_success">Successfully saved all Wox settings</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">System Commands</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">Provides System related commands. e.g. shutdown, lock, settings etc.</system:String>
|
||||
|
||||
|
@ -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"),
|
||||
|
@ -57,6 +57,11 @@ namespace Wox.Plugin
|
||||
[Obsolete]
|
||||
void ShowApp();
|
||||
|
||||
/// <summary>
|
||||
/// Save all Wox settings
|
||||
/// </summary>
|
||||
void SaveAppAllSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Show message box
|
||||
/// </summary>
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user