Exemple #1
0
        /// <summary>Called when a key on the keyboard has been released again</summary>
        /// <param name="keyCode">Code of the key that was released</param>
        public void InjectKeyRelease(Keys keyCode)
        {
            if (!_heldKeys.Get((int)keyCode))
            {
                return;
            }
            --_heldKeyCount;
            _heldKeys.Set((int)keyCode, false);

            // If a control signed responsible for the earlier key press, it will now
            // receive the release notification.
            _activatedControl?.ProcessKeyRelease(keyCode);

            // Reset the activated control if the user has released all buttons on all
            // input devices.
            if (!AnyKeysOrButtonsPressed)
            {
                _activatedControl = null;
            }
        }