Skip to content

Commit

Permalink
Optimize HotkeyHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Feb 27, 2025
1 parent 98613c4 commit c0cd46a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion v2rayN/v2rayN.Desktop/Handler/HotkeyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public void Init(Config config, Action<EGlobalHotkey> updateFunc)
{
_config = config;
_updateFunc = updateFunc;
_hotKeyManager = new GlobalHotKeys.HotKeyManager();

Register();
}
Expand All @@ -36,6 +35,11 @@ public void Dispose()

private void Register()
{
if (_config.GlobalHotkeys.Any(t => t.KeyCode > 0) == false)
{
return;
}
_hotKeyManager ??= new GlobalHotKeys.HotKeyManager();
_hotkeyTriggerDic.Clear();

foreach (var item in _config.GlobalHotkeys)
Expand Down

0 comments on commit c0cd46a

Please # to comment.