Beispiel #1
0
        public void RegisterHotKey()
        {
            if (Key == Keys.None)
            {
                return;
            }
            if (_isKeyRegistered)
            {
                UnregisterHotKey();
            }
            _isKeyRegistered = HotKeyWinApi.RegisterHotKey(_handle, _id, KeyModifier, Key);
            if (!_isKeyRegistered)
            {
                //TODO:弹窗提醒 热键冲突
                //throw new ApplicationException("Hotkey already in use");

                //MessageBox.Show("快捷热键【Ctrl+Alt+A】已经被占用!");
            }
        }
Beispiel #2
0
 public void UnregisterHotKey()
 {
     _isKeyRegistered = !HotKeyWinApi.UnregisterHotKey(_handle, _id);
 }