mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Remove autohotkey and add toggle command args
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
using AutoHotkey.Interop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Infrastructure.Hotkey
|
||||
{
|
||||
public class AHKHotkey : IHotkey
|
||||
{
|
||||
public bool RegisterHotkey(string hotkey, Action action)
|
||||
{
|
||||
AutoHotkeyEngine ahk = AHKHotkeyEngineFactory.CreateOrGet("default");
|
||||
ahk.ExecRaw(string.Format("{0}::MsgBox, ssss!",hotkey));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using AutoHotkey.Interop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Infrastructure.Hotkey
|
||||
{
|
||||
internal class AHKHotkeyEngineFactory
|
||||
{
|
||||
private static List<KeyValuePair<string, AutoHotkeyEngine>> engines = new List<KeyValuePair<string, AutoHotkeyEngine>>();
|
||||
|
||||
public static AutoHotkeyEngine CreateOrGet(string name)
|
||||
{
|
||||
AutoHotkeyEngine engine = Get(name);
|
||||
if (engine == null)
|
||||
{
|
||||
engine = Create(name);
|
||||
}
|
||||
return engine;
|
||||
}
|
||||
|
||||
public static AutoHotkeyEngine Create(string name)
|
||||
{
|
||||
var ahk = new AutoHotkey.Interop.AutoHotkeyEngine();
|
||||
engines.Add(new KeyValuePair<string, AutoHotkeyEngine>(name, ahk));
|
||||
return ahk;
|
||||
}
|
||||
|
||||
public static AutoHotkeyEngine Get(string name)
|
||||
{
|
||||
var engine = engines.FirstOrDefault(o => o.Key == name);
|
||||
if (engine.Key != null)
|
||||
{
|
||||
return engine.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Destroy(string name)
|
||||
{
|
||||
var engine = engines.FirstOrDefault(o => o.Key == name);
|
||||
if (engine.Key != null)
|
||||
{
|
||||
engine.Value.Terminate();
|
||||
engines.Remove(engine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Infrastructure.Hotkey
|
||||
{
|
||||
interface IHotkey
|
||||
{
|
||||
bool RegisterHotkey(string hotkey, Action action);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user