Add 'src/modules/launcher/' from commit '28acd466b352a807910cebbc74477d3173b31511'
git-subtree-dir: src/modules/launcher git-subtree-mainline:852689b3dfgit-subtree-split:28acd466b3
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/app.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 23 KiB |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/close.png
Normal file
|
After Width: | Height: | Size: 530 B |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/lock.png
Normal file
|
After Width: | Height: | Size: 759 B |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/logoff.png
Normal file
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 436 B |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/restart.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/shutdown.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/modules/launcher/Plugins/Wox.Plugin.Sys/Images/sleep.png
Normal file
|
After Width: | Height: | Size: 760 B |
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_command">Befehl</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_desc">Beschreibung</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_shutdown_computer">Computer herunterfahren</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart_computer">Computer neu starten</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_log_off">Abmelden</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">Computer sperren</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">Wox schließen</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">Wox neu starten</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">Anwendung beschleunigen</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">Computer in Schlafmodus versetzen</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Papierkorb leeren</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">Systembefehle</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">Stellt Systemrelevante Befehle bereit. z.B. herunterfahren, sperren, Einstellungen, usw.</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,32 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<!--Command List-->
|
||||
<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_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_hibernate">Hibernate computer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_save_all_settings">Save all Wox settings</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_reload_plugin_data">Reloads plugin data with new content added after Wox started. Plugins need to have this feature already added.</system:String>
|
||||
|
||||
<!--Dialogs-->
|
||||
<system:String x:Key="wox_plugin_sys_dlgtitle_success">Success</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_all_settings_saved">All Wox settings saved</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_all_applicableplugins_reloaded">Reloaded all applicable plugin data</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_shutdown_computer">Are you sure you want to shut the computer down?</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_restart_computer">Are you sure you want to restart the computer?</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>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_command">コマンド</system:String>
|
||||
<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">コンピュータを再起動する</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">ゴミ箱を空にする</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">システムコマンド</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">システム関連のコマンドを提供します。例:シャットダウン、ロック、設定など</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_command">Komenda</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_desc">Opis</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_shutdown_computer">Wyłącz komputer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart_computer">Uruchom ponownie komputer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_log_off">Wyloguj się</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">Zablokuj ten komputer</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">Wyłącz Woxa</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">Uruchom ponownie Woxa</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">Dostosuj ustawienia</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">Przełącz komputer w tryb uśpienia</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Opróżnij kosz</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">Komendy systemowe</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">Wykonywanie komend systemowych, np. wyłącz, zablokuj komputer, otwórz ustawienia itp.</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,32 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<!--Komut Listesi-->
|
||||
<system:String x:Key="wox_plugin_sys_command">Komut</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_desc">Açıklama</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_shutdown_computer">Bilgisayarı Kapat</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart_computer">Yeniden Başlat</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_log_off">Oturumu Kapat</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_lock">Bilgisayarı Kilitle</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_exit">Wox'u Kapat</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_restart">Wox'u Yeniden Başlat</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_setting">Wox Ayarlarını Aç</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_sleep">Bilgisayarı Uyku Moduna Al</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_emptyrecyclebin">Geri Dönüşüm Kutusunu Boşalt</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_hibernate">Bilgisayarı Askıya Al</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_save_all_settings">Tüm Wox Ayarlarını Kaydet</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_reload_plugin_data">Eklentilerin verilerini Wox'un açılışından sonra yapılan değişiklikleri için günceller. Eklentilerin bu özelliği zaten eklemiş olması gerekir.</system:String>
|
||||
|
||||
<!--Diyaloglar-->
|
||||
<system:String x:Key="wox_plugin_sys_dlgtitle_success">Başarılı</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_all_settings_saved">Tüm Wox ayarları kaydedildi.</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_shutdown_computer">Bilgisayarı kapatmak istediğinize emin misiniz?</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_dlgtext_restart_computer">Bilgisayarı yeniden başlatmak istediğinize emin misiniz?</system:String>
|
||||
|
||||
<!--Eklenti Bilgisi-->
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">Sistem Komutları</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">Sistem ile ilgili komutlara erişim sağlar. ör. shutdown, lock, settings vb.</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
|
||||
<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">重启这台电脑</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">清空回收站</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">系统命令</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">系统系统相关的命令。例如,关机,锁定,设置等</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,21 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
|
||||
<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">電腦重新啟動</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">清空資源回收桶</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_sys_plugin_name">系統命令</system:String>
|
||||
<system:String x:Key="wox_plugin_sys_plugin_description">系統相關的命令。例如,關機,鎖定,設定等</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
266
src/modules/launcher/Plugins/Wox.Plugin.Sys/Main.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
using Wox.Infrastructure;
|
||||
using Application = System.Windows.Application;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
using FormsApplication = System.Windows.Forms.Application;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Wox.Plugin.Sys
|
||||
{
|
||||
public class Main : IPlugin, ISettingProvider, IPluginI18n
|
||||
{
|
||||
private PluginInitContext context;
|
||||
|
||||
#region DllImport
|
||||
|
||||
internal const int EWX_LOGOFF = 0x00000000;
|
||||
internal const int EWX_SHUTDOWN = 0x00000001;
|
||||
internal const int EWX_REBOOT = 0x00000002;
|
||||
internal const int EWX_FORCE = 0x00000004;
|
||||
internal const int EWX_POWEROFF = 0x00000008;
|
||||
internal const int EWX_FORCEIFHUNG = 0x00000010;
|
||||
|
||||
[DllImport("user32")]
|
||||
private static extern bool ExitWindowsEx(uint uFlags, uint dwReason);
|
||||
|
||||
[DllImport("user32")]
|
||||
private static extern void LockWorkStation();
|
||||
|
||||
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern uint SHEmptyRecycleBin(IntPtr hWnd, uint dwFlags);
|
||||
|
||||
// http://www.pinvoke.net/default.aspx/Enums/HRESULT.html
|
||||
private enum HRESULT : uint
|
||||
{
|
||||
S_FALSE = 0x0001,
|
||||
S_OK = 0x0000
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Control CreateSettingPanel()
|
||||
{
|
||||
var results = Commands();
|
||||
return new SysSettings(results);
|
||||
}
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
var commands = Commands();
|
||||
var results = new List<Result>();
|
||||
foreach (var c in commands)
|
||||
{
|
||||
var titleMatch = StringMatcher.FuzzySearch(query.Search, c.Title);
|
||||
var subTitleMatch = StringMatcher.FuzzySearch(query.Search, c.SubTitle);
|
||||
|
||||
var score = Math.Max(titleMatch.Score, subTitleMatch.Score);
|
||||
if (score > 0)
|
||||
{
|
||||
c.Score = score;
|
||||
if (score == titleMatch.Score)
|
||||
{
|
||||
c.TitleHighlightData = titleMatch.MatchData;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.SubTitleHighlightData = subTitleMatch.MatchData;
|
||||
}
|
||||
results.Add(c);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private List<Result> Commands()
|
||||
{
|
||||
var results = new List<Result>();
|
||||
results.AddRange(new[]
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = "Shutdown",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
|
||||
IcoPath = "Images\\shutdown.png",
|
||||
Action = c =>
|
||||
{
|
||||
var reuslt = MessageBox.Show(context.API.GetTranslation("wox_plugin_sys_dlgtext_shutdown_computer"),
|
||||
context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
if (reuslt == MessageBoxResult.Yes)
|
||||
{
|
||||
Process.Start("shutdown", "/s /t 0");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Restart",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart_computer"),
|
||||
IcoPath = "Images\\restart.png",
|
||||
Action = c =>
|
||||
{
|
||||
var result = MessageBox.Show(context.API.GetTranslation("wox_plugin_sys_dlgtext_restart_computer"),
|
||||
context.API.GetTranslation("wox_plugin_sys_restart_computer"),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
Process.Start("shutdown", "/r /t 0");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Log Off",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
|
||||
IcoPath = "Images\\logoff.png",
|
||||
Action = c => ExitWindowsEx(EWX_LOGOFF, 0)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Lock",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_lock"),
|
||||
IcoPath = "Images\\lock.png",
|
||||
Action = c =>
|
||||
{
|
||||
LockWorkStation();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Sleep",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"),
|
||||
IcoPath = "Images\\sleep.png",
|
||||
Action = c => FormsApplication.SetSuspendState(PowerState.Suspend, false, false)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Hibernate",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_hibernate"),
|
||||
IcoPath = "Images\\sleep.png", // Icon change needed
|
||||
Action = c => FormsApplication.SetSuspendState(PowerState.Hibernate, false, false)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Empty Recycle Bin",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_emptyrecyclebin"),
|
||||
IcoPath = "Images\\recyclebin.png",
|
||||
Action = c =>
|
||||
{
|
||||
// http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html
|
||||
// FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED))
|
||||
// 0 for nothing
|
||||
var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
|
||||
if (result != (uint) HRESULT.S_OK && result != (uint)0x8000FFFF)
|
||||
{
|
||||
MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" +
|
||||
"please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137",
|
||||
"Error",
|
||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Exit",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),
|
||||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
Application.Current.MainWindow.Close();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Save Settings",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_save_all_settings"),
|
||||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.SaveAppAllSettings();
|
||||
context.API.ShowMsg(context.API.GetTranslation("wox_plugin_sys_dlgtitle_success"),
|
||||
context.API.GetTranslation("wox_plugin_sys_dlgtext_all_settings_saved"));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Restart Wox",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),
|
||||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.RestarApp();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Settings",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_setting"),
|
||||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.OpenSettingDialog();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Reload Plugin Data",
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_reload_plugin_data"),
|
||||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
// Hide the window first then show msg after done because sometimes the reload could take a while, so not to make user think it's frozen.
|
||||
Application.Current.MainWindow.Hide();
|
||||
context.API.ReloadAllPluginData();
|
||||
context.API.ShowMsg(context.API.GetTranslation("wox_plugin_sys_dlgtitle_success"),
|
||||
context.API.GetTranslation("wox_plugin_sys_dlgtext_all_applicableplugins_reloaded"));
|
||||
return true;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Check For Update",
|
||||
SubTitle = "Check for new Wox update",
|
||||
IcoPath = "Images\\checkupdate.png",
|
||||
Action = c =>
|
||||
{
|
||||
Application.Current.MainWindow.Hide();
|
||||
context.API.CheckForNewUpdate();
|
||||
context.API.ShowMsg("Please wait...",
|
||||
"Checking for new update");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_sys_plugin_name");
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_sys_plugin_description");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Wox.Plugin.Sys")]
|
||||
[assembly: Guid("e1eecff6-3f25-424d-9bbd-cbd7d6e1e11e")]
|
||||
31
src/modules/launcher/Plugins/Wox.Plugin.Sys/SysSettings.xaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<UserControl x:Class="Wox.Plugin.Sys.SysSettings"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid Margin="10">
|
||||
<ListView x:Name="lbxCommands" Grid.Row="0">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{DynamicResource wox_plugin_sys_command}" Width="150">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{DynamicResource wox_plugin_sys_desc}" Width="Auto">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding SubTitle}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Wox.Plugin.Sys
|
||||
{
|
||||
public partial class SysSettings : UserControl
|
||||
{
|
||||
public SysSettings(List<Result> Results)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
foreach (var Result in Results)
|
||||
{
|
||||
lbxCommands.Items.Add(Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0B9DE348-9361-4940-ADB6-F5953BFFCCEC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Wox.Plugin.Sys</RootNamespace>
|
||||
<AssemblyName>Wox.Plugin.Sys</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Sys\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins\Wox.Plugin.Sys\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="JetBrains.Annotations, Version=10.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\JetBrains.Annotations.10.3.0\lib\net\JetBrains.Annotations.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\SolutionAssemblyInfo.cs">
|
||||
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="SysSettings.xaml.cs">
|
||||
<DependentUpon>SysSettings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||
<Name>Wox.Infrastructure</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
|
||||
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
|
||||
<Name>Wox.Plugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\checkupdate.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="Images\recyclebin.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Images\shutdown.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="Images\sleep.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\en.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\zh-cn.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\zh-tw.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\de.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\pl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\tr.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Page Include="SysSettings.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\lock.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\logoff.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\close.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\app.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Images\restart.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Images\Images\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations">
|
||||
<Version>10.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime">
|
||||
<Version>4.0.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
12
src/modules/launcher/Plugins/Wox.Plugin.Sys/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ID":"CEA08895D2544B019B2E9C5009600DF4",
|
||||
"ActionKeyword":"*",
|
||||
"Name":"System Commands",
|
||||
"Description":"Provide System related commands. e.g. shutdown,lock,setting etc.",
|
||||
"Author":"qianlifeng",
|
||||
"Version":"1.0.0",
|
||||
"Language":"csharp",
|
||||
"Website":"http://www.wox.one/plugin",
|
||||
"ExecuteFileName":"Wox.Plugin.Sys.dll",
|
||||
"IcoPath":"Images\\lock.png"
|
||||
}
|
||||