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
mainWindowMainWindow
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
hotkeyNamestring快捷键名称
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
hotkeyNamestring快捷键名称
keyKey按键
modifiersModifierKeys修饰键
actionAction执行动作
Returns
- bool
是否注册成功
SaveHotkeysToSettings()
保存快捷键配置到设置
public void SaveHotkeysToSettings()
UnregisterAllHotkeys()
注销所有快捷键
public void UnregisterAllHotkeys()
UnregisterHotkey(string)
注销指定快捷键
public bool UnregisterHotkey(string hotkeyName)
Parameters
hotkeyNamestring快捷键名称
Returns
- bool
是否注销成功
UpdateHotkey(string, Key, ModifierKeys)
更新快捷键配置
public bool UpdateHotkey(string hotkeyName, Key key, ModifierKeys modifiers)
Parameters
hotkeyNamestring快捷键名称
keyKey新按键
modifiersModifierKeys新修饰键
Returns
- bool
是否更新成功
UpdateHotkeyStateForToolMode(bool)
根据当前工具模式更新快捷键状态 在工具切换时调用此方法
public void UpdateHotkeyStateForToolMode(bool isMouseMode)
Parameters
isMouseModebool是否为鼠标模式(选择模式)