Esempio n. 1
0
        private bool IsModDown(KeyboardDevice keyboard)
        {
            bool down = true;

            down &= (Mods & ModifierKeys.Alt) == ModifierKeys.Alt
                == (keyboard.IsKeyDown(Key.LeftAlt) || keyboard.IsKeyDown(Key.RightAlt));

            down &= (Mods & ModifierKeys.Control) == ModifierKeys.Control
                == (keyboard.IsKeyDown(Key.LeftCtrl) || keyboard.IsKeyDown(Key.RightCtrl));

            down &= (Mods & ModifierKeys.Shift) == ModifierKeys.Shift
                == (keyboard.IsKeyDown(Key.LeftShift) || keyboard.IsKeyDown(Key.RightShift));

            down &= (Mods & ModifierKeys.Windows) == ModifierKeys.Windows
                == (keyboard.IsKeyDown(Key.LWin) || keyboard.IsKeyDown(Key.RWin));

            return down;
        }
Esempio n. 2
0
        private bool ProcessKeyState(KeyboardDevice device, Key curKey, Key retKey, params Key[] addlKeys)
        {
            if (curKey == Key.LeftCtrl || curKey == Key.RightCtrl) return false;

            if (!(addlKeys.Any(aKey => device.IsKeyDown(aKey)) || device.IsKeyDown(retKey)))
                return true;

            var msgs = _mDict.ProcessKey(retKey);
            msgs.Do(msg => msg.Invoke(this));
            return true;
        }