Table of Contents

Class GlobalHotkeyManager

Namespace
Ink_Canvas.Helpers
Assembly
InkCanvasForClass.dll

全局快捷键管理器 - 使用NHotkey库实现全局快捷键功能

public class GlobalHotkeyManager : IDisposable
Inheritance
GlobalHotkeyManager
Implements
Inherited Members

Constructors

GlobalHotkeyManager(MainWindow)

public GlobalHotkeyManager(MainWindow mainWindow)

Parameters

mainWindow MainWindow

Methods

DisableHotkeyRegistration()

禁用快捷键注册功能 调用此方法后,快捷键将被注销

public void DisableHotkeyRegistration()

DisableScreenSpecificHotkeys()

禁用基于屏幕的热键注册

public void DisableScreenSpecificHotkeys()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

EnableHotkeyRegistration()

启用快捷键注册功能 调用此方法后,快捷键将被允许注册

public void EnableHotkeyRegistration()

EnableScreenSpecificHotkeys()

启用基于屏幕的热键注册

public void EnableScreenSpecificHotkeys()

GetCurrentScreenInfo()

获取当前屏幕信息

public string GetCurrentScreenInfo()

Returns

string

当前屏幕信息

GetHotkeysFromConfigFile()

获取配置文件中的快捷键信息(不注册,仅用于显示)

public List<GlobalHotkeyManager.HotkeyInfo> GetHotkeysFromConfigFile()

Returns

List<GlobalHotkeyManager.HotkeyInfo>

配置文件中的快捷键列表

GetRegisteredHotkeys()

获取已注册的快捷键列表

public List<GlobalHotkeyManager.HotkeyInfo> GetRegisteredHotkeys()

Returns

List<GlobalHotkeyManager.HotkeyInfo>

快捷键信息列表

IsHotkeyRegistered(string)

检查快捷键是否已注册

public bool IsHotkeyRegistered(string hotkeyName)

Parameters

hotkeyName string

快捷键名称

Returns

bool

是否已注册

IsScreenSpecificHotkeysEnabled()

检查是否启用了基于屏幕的热键注册

public bool IsScreenSpecificHotkeysEnabled()

Returns

bool

是否启用

LoadHotkeysFromSettings()

从配置文件加载快捷键

public void LoadHotkeysFromSettings()

RefreshCurrentScreenHotkeys()

手动刷新当前屏幕的热键注册

public void RefreshCurrentScreenHotkeys()

RegisterDefaultHotkeys()

注册默认快捷键集合

public void RegisterDefaultHotkeys()

RegisterHotkey(string, Key, ModifierKeys, Action)

注册全局快捷键

public bool RegisterHotkey(string hotkeyName, Key key, ModifierKeys modifiers, Action action)

Parameters

hotkeyName string

快捷键名称

key Key

按键

modifiers ModifierKeys

修饰键

action Action

执行动作

Returns

bool

是否注册成功

SaveHotkeysToSettings()

保存快捷键配置到设置

public void SaveHotkeysToSettings()

UnregisterAllHotkeys()

注销所有快捷键

public void UnregisterAllHotkeys()

UnregisterHotkey(string)

注销指定快捷键

public bool UnregisterHotkey(string hotkeyName)

Parameters

hotkeyName string

快捷键名称

Returns

bool

是否注销成功

UpdateHotkey(string, Key, ModifierKeys)

更新快捷键配置

public bool UpdateHotkey(string hotkeyName, Key key, ModifierKeys modifiers)

Parameters

hotkeyName string

快捷键名称

key Key

新按键

modifiers ModifierKeys

新修饰键

Returns

bool

是否更新成功

UpdateHotkeyStateForToolMode(bool)

根据当前工具模式更新快捷键状态 在工具切换时调用此方法

public void UpdateHotkeyStateForToolMode(bool isMouseMode)

Parameters

isMouseMode bool

是否为鼠标模式(选择模式)