void xkeysEngine_XkeyPressed(object sender, XkeyPressedEventArgs e)
        {
            if (!CodeRush.IDE.IsActive)
            {
                return;
            }

            lock (keyBuffer)
            {
                lastCustomData = e.CustomData;
                keyBuffer.Add(e);
            }

            _UIContext.Post(s =>
            {
                ProcessShortcutsOnUIThread();
            }, null);
        }
        protected virtual void OnXkeyPressed(List <KeyBase> keysDown, string customData)
        {
            if (lastDataSent == customData && DateTime.Now - lastTimeSent < TimeSpan.FromMilliseconds(250))
            {
                return;
            }
            lastDataSent = customData;
            XkeyPressedEventHandler handler = XkeyPressed;

            if (handler != null)
            {
                Keys modifierKeys = Control.ModifierKeys;
                bool shiftKeyDown = (modifierKeys & Keys.Shift) == Keys.Shift;
                bool ctrlKeyDown  = (modifierKeys & Keys.Control) == Keys.Control;
                bool altKeyDown   = (modifierKeys & Keys.Alt) == Keys.Alt;

                // Important: This next line (new XkeyPressedEventArgs(...)) is crucial for the current multi-threaded implementation. DO NOT CHANGE to a shared event args approach (considered more memory-efficient and performant).
                XkeyPressedEventArgs e = new XkeyPressedEventArgs(keysDown, shiftKeyDown, ctrlKeyDown, altKeyDown, customData);
                handler(this, e);
            }
            lastTimeSent = DateTime.Now;
        }
        void xkeysEngine_XkeyPressed(object sender, XkeyPressedEventArgs e)
        {
            if (!IsHandleCreated)
            {
                return;
            }

            if (e.KeysDown.Count == 0)
            {
                return; // No keys pressed.
            }
            bool shiftDown = e.ShiftKeyDown;
            bool ctrlDown  = e.CtrlKeyDown;
            bool altDown   = e.AltKeyDown;

            customData = e.CustomData;
            this.Invoke((MethodInvoker) delegate
            {
                AltKeyDown   = altDown;
                CtrlKeyDown  = ctrlDown;
                ShiftKeyDown = shiftDown;
                OnCustomInputChangedAndFocused();
            });
        }