public void RegisterHotKey() { if (Key == Keys.None) { return; } if (_isKeyRegistered) { UnregisterHotKey(); } _isKeyRegistered = HotKeyWinApi.RegisterHotKey(_handle, _id, KeyModifier, Key); if (!_isKeyRegistered) { throw new ApplicationException(string.Format("快捷键{0}|{1}已被占用", KeyModifier, Key)); } }
public void UnregisterHotKey() { _isKeyRegistered = !HotKeyWinApi.UnregisterHotKey(_handle, _id); }