Beispiel #1
0
        private void ProcessKeyboard()
        {
            KeyboardState state = Keyboard.GetState();
            var           currentPressedKeys = state.GetPressedKeys();
            var           keysDown           = currentPressedKeys.Except(_lastPressedKeys);
            var           keysUp             = _lastPressedKeys.Except(currentPressedKeys);

            _lastPressedKeys = currentPressedKeys;

            if (keysUp.Any() || keysDown.Any())
            {
                var modiferKeys = GetModifierKeys(state);

                using (_slate.Lock())
                {
                    foreach (var key in keysUp)
                    {
                        _slate.KeyUp(Translate(key), modiferKeys);
                    }

                    foreach (var key in keysDown)
                    {
                        _slate.KeyDown(Translate(key), modiferKeys);
                    }
                }
            }
        }
Beispiel #2
0
 public virtual void KeyDown(Key key, ModifierKeys modifierKeys)
 {
     _source.KeyDown(key, modifierKeys);
 }