mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
*Moved everything to dev branch
- Sorry for the trouble
This commit is contained in:
BIN
Plugins/Wox.Plugin.Sys/Images/recyclebin.png
Normal file
BIN
Plugins/Wox.Plugin.Sys/Images/recyclebin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
Plugins/Wox.Plugin.Sys/Images/restartcomp.png
Normal file
BIN
Plugins/Wox.Plugin.Sys/Images/restartcomp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -6,12 +6,14 @@
|
||||
<system:String x:Key="wox_plugin_sys_desc">Description</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_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_plugin_name">System Commands</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">Provide System related commands. e.g. shutdown,lock,setting etc.</system:String>
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_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">注销</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">锁定这台电脑</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">重启Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">设置</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">休眠这台电脑</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Empty recycle bin</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">系统命令</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">系统系统相关的命令。例如,关机,锁定,设置等</system:String>
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_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">註銷</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">鎖定這臺電腦</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">重啟Wox</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">設置</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">休眠这台电脑</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Empty recycle bin</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">系統命令</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">系統系統相關的命令。例如,關機,鎖定,設置等</system:String>
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace Wox.Plugin.Sys
|
||||
[DllImport("user32")]
|
||||
private static extern void LockWorkStation();
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762160(v=vs.85).aspx
|
||||
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern uint SHEmptyRecycleBin(System.IntPtr hwnd, string pszRootPath, uint dwFlags);
|
||||
|
||||
#endregion
|
||||
|
||||
public Control CreateSettingPanel()
|
||||
@@ -73,6 +77,19 @@ namespace Wox.Plugin.Sys
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Restart",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart_computer"),
|
||||
IcoPath = "Images\\restartcomp.png",
|
||||
Action = (c) =>
|
||||
{
|
||||
if (MessageBox.Show("Are you sure you want to restart the computer?","Restart Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) {
|
||||
Process.Start("shutdown", "/r /t 0");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Log off",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
|
||||
@@ -96,6 +113,26 @@ namespace Wox.Plugin.Sys
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"),
|
||||
IcoPath = "Images\\sleep.png",
|
||||
Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Empty Recycle Bin",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_emptyrecyclebin"),
|
||||
IcoPath = "Images\\recyclebin.png",
|
||||
Action = (c) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Using 0 for the last part, let's us use all the windows pop-up and sounds
|
||||
uint result = SHEmptyRecycleBin(System.IntPtr.Zero, null, 0);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error emptying recycle bin. \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
|
||||
@@ -63,6 +63,12 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\recyclebin.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\restartcomp.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\sleep.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -129,5 +135,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user