Пример #1
0
        private void WindowKeyDownHandler(CoreWindow sender, KeyEventArgs args)
        {
            // Watch for Ctrl+Alt+Shift to toggle mouse binding
            if ((KeyboardHelper.GetModifierFlags() & (byte)(Modifier.ModifierShift | Modifier.ModifierAlt | Modifier.ModifierCtrl)) ==
                (byte)(Modifier.ModifierShift | Modifier.ModifierAlt | Modifier.ModifierCtrl))
            {
                if (capturingMouse)
                {
                    ReleaseMouse();
                }
                else
                {
                    CaptureMouse();
                }
            }

            short key = KeyboardHelper.TranslateVirtualKey(args.VirtualKey);

            if (key != 0)
            {
                MoonlightCommonRuntimeComponent.SendKeyboardEvent(key, (byte)KeyAction.Down,
                                                                  KeyboardHelper.GetModifierFlags());

                args.Handled = true;
            }
        }
Пример #2
0
        private void WindowKeyUpHandler(CoreWindow sender, KeyEventArgs args)
        {
            short key = KeyboardHelper.TranslateVirtualKey(args.VirtualKey);

            if (key != 0)
            {
                MoonlightCommonRuntimeComponent.SendKeyboardEvent(key, (byte)KeyAction.Up,
                                                                  KeyboardHelper.GetModifierFlags());

                args.Handled = true;
            }
        }