Пример #1
0
        public void ProcessKeyInput(double deltaTime)
        {
            var pressedKeys = appender.Input.GetPressedKeys();

            bool isShiftPressed = appender.Input.IsKeyPressed(Keys.LeftShift) ||
                                  appender.Input.IsKeyPressed(Keys.RightShift);


            foreach (Keys key in pressedKeys)
            {
                if (!ShouldHandleKey(key, deltaTime))
                {
                    continue;
                }

                char convertedChar;
                if (KeyboardUtils.KeyToString(key, isShiftPressed, out convertedChar))
                {
                    if (!appender.ShouldHandleKey(key, convertedChar))
                    {
                        continue;
                    }
                    KeyPressed.RaiseEvent(this, convertedChar);
                }
                else
                {
                    switch (key)
                    {
                    case Keys.Back:
                        BackSpace.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Delete:
                        Delete.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Left:
                        Left.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Right:
                        Right.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Up:
                        Up.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Down:
                        Down.RaiseEvent(this, EventArgs.Empty);
                        break;

                    case Keys.Enter:
                        Insert.RaiseEvent(this, EventArgs.Empty);
                        break;
                    }
                }
            }
        }
Пример #2
0
 protected void RaiseKeyPressed(DriverKeyPressedEventArgs e)
 {
     KeyPressed.RaiseEvent(this, e);
 }
Пример #3
0
 private void KeyboardKeyPressed(object sender, KeyEventArgs e)
 {
     KeyPressed.RaiseEvent(sender, e);
 }