mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
fix names
This commit is contained in:
@@ -12,19 +12,19 @@ using Application = System.Windows.Application;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
using Keys = System.Windows.Forms.Keys;
|
||||
|
||||
namespace Wox.Plugin.CMD
|
||||
namespace Wox.Plugin.Shell
|
||||
{
|
||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
|
||||
public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
|
||||
{
|
||||
private const string Image = "Images/shell.png";
|
||||
private PluginInitContext context;
|
||||
private bool WinRStroked;
|
||||
private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
||||
private PluginInitContext _context;
|
||||
private bool _winRStroked;
|
||||
private readonly KeyboardSimulator _keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
||||
|
||||
private readonly Settings _settings;
|
||||
private readonly PluginJsonStorage<Settings> _storage;
|
||||
|
||||
public CMD()
|
||||
public Main()
|
||||
{
|
||||
_storage = new PluginJsonStorage<Settings>();
|
||||
_settings = _storage.Load();
|
||||
@@ -104,14 +104,14 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
if (m.Key == cmd)
|
||||
{
|
||||
result.SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value);
|
||||
result.SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value);
|
||||
return null;
|
||||
}
|
||||
|
||||
var ret = new Result
|
||||
{
|
||||
Title = m.Key,
|
||||
SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
|
||||
SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
|
||||
IcoPath = Image,
|
||||
Action = c =>
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
Title = cmd,
|
||||
Score = 5000,
|
||||
SubTitle = context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"),
|
||||
SubTitle = _context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"),
|
||||
IcoPath = Image,
|
||||
Action = c =>
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace Wox.Plugin.CMD
|
||||
.Select(m => new Result
|
||||
{
|
||||
Title = m.Key,
|
||||
SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
|
||||
SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
|
||||
IcoPath = Image,
|
||||
Action = c =>
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace Wox.Plugin.CMD
|
||||
command = Environment.ExpandEnvironmentVariables(command);
|
||||
|
||||
ProcessStartInfo info;
|
||||
if (_settings.Shell == Shell.CMD)
|
||||
if (_settings.Shell == Shell.Cmd)
|
||||
{
|
||||
var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause";
|
||||
info = new ProcessStartInfo
|
||||
@@ -268,7 +268,7 @@ namespace Wox.Plugin.CMD
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
this._context = context;
|
||||
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
|
||||
}
|
||||
|
||||
@@ -278,13 +278,13 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed)
|
||||
{
|
||||
WinRStroked = true;
|
||||
_winRStroked = true;
|
||||
OnWinRPressed();
|
||||
return false;
|
||||
}
|
||||
if (keyevent == (int)KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin)
|
||||
if (keyevent == (int)KeyEvent.WM_KEYUP && _winRStroked && vkcode == (int)Keys.LWin)
|
||||
{
|
||||
WinRStroked = false;
|
||||
_winRStroked = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -293,7 +293,7 @@ namespace Wox.Plugin.CMD
|
||||
|
||||
private void OnWinRPressed()
|
||||
{
|
||||
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}");
|
||||
_context.API.ChangeQuery($"{_context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}");
|
||||
Application.Current.MainWindow.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
@@ -304,12 +304,12 @@ namespace Wox.Plugin.CMD
|
||||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_cmd_plugin_name");
|
||||
return _context.API.GetTranslation("wox_plugin_cmd_plugin_name");
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_cmd_plugin_description");
|
||||
return _context.API.GetTranslation("wox_plugin_cmd_plugin_description");
|
||||
}
|
||||
|
||||
public List<Result> LoadContextMenus(Result selectedResult)
|
||||
@@ -318,7 +318,7 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"),
|
||||
Title = _context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"),
|
||||
Action = c =>
|
||||
{
|
||||
Execute(selectedResult.Title, true);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.Plugin.CMD
|
||||
namespace Wox.Plugin.Shell
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public Shell Shell { get; set; } = Shell.CMD;
|
||||
public Shell Shell { get; set; } = Shell.Cmd;
|
||||
public bool ReplaceWinR { get; set; } = true;
|
||||
public bool LeaveShellOpen { get; set; }
|
||||
public Dictionary<string, int> Count = new Dictionary<string, int>();
|
||||
@@ -24,7 +24,7 @@ namespace Wox.Plugin.CMD
|
||||
|
||||
public enum Shell
|
||||
{
|
||||
CMD = 0,
|
||||
Cmd = 0,
|
||||
Powershell = 1,
|
||||
RunCommand = 2,
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="Wox.Plugin.CMD.CMDSetting"
|
||||
<UserControl x:Class="Wox.Plugin.Shell.CMDSetting"
|
||||
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"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Wox.Plugin.CMD
|
||||
namespace Wox.Plugin.Shell
|
||||
{
|
||||
public partial class CMDSetting : UserControl
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user