Ejemplo n.º 1
0
        void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            // I can capture the arrow keys here
            if (!mnuInGame.IsFocused)
            {
                char c = '\0';

                switch (e.Key)
                {
                case Key.Tab:
                    c = '\t'; break;

                case Key.Up:
                    c = (char)Frotz.Constants.CharCodes.ZC_ARROW_UP;
                    break;

                case Key.Down:
                    c = (char)Frotz.Constants.CharCodes.ZC_ARROW_DOWN;
                    break;

                case Key.Left:
                    c = (char)Frotz.Constants.CharCodes.ZC_ARROW_LEFT;
                    break;

                case Key.Right:
                    c = (char)Frotz.Constants.CharCodes.ZC_ARROW_RIGHT;
                    break;
                }

                if (c != 0)
                {
                    _screen.AddInput(c);
                    e.Handled = true;
                }
            }
        }