示例#1
0
        private void AddKeyUp(WindowsAPI.VirtualKeyCode keyCode)
        {
            var key = new WindowsAPI.Input {
                Type = WindowsAPI.InputType.Keyboard,
                Data =
                {
                    Keyboard      = new WindowsAPI.KeyboardInput {
                        KeyCode   = (UInt16)keyCode,
                        Scan      = 0,
                        Flags     = (uint)WindowsAPI.KeyEvent.KeyUp,
                        Time      = 0,
                        ExtraInfo = IntPtr.Zero
                    }
                }
            };

            _input.Add(key);
        }
示例#2
0
        public ApplicationAction RemoveItem(int index)
        {
            var  current      = 0;
            var  downKeyIndex = 0;
            var  upKeyIndex   = 0;
            bool downFound    = false;

            for (int i = 0; i < _input.Count; i++)
            {
                if (_input[i].Data.Keyboard.Flags == 0 && !downFound)
                {
                    if (index == current)
                    {
                        downKeyIndex = i;
                        downFound    = true;
                    }
                    current++;
                }
                else if (_input[i].Data.Keyboard.Flags != 0 && downFound)
                {
                    if (_input[i].Data.Keyboard.KeyCode == _input[downKeyIndex].Data.Keyboard.KeyCode)
                    {
                        upKeyIndex = i;
                        break;
                    }
                }
            }

            WindowsAPI.Input downKey = _input[downKeyIndex];
            WindowsAPI.Input upKey   = _input[upKeyIndex];

            _input.Remove(downKey);
            _input.Remove(upKey);

            return(this);
        }
示例#3
0
文件: KeyInput.cs 项目: n8o/libcec
        private void AddKeyUp(WindowsAPI.VirtualKeyCode keyCode)
        {
            var key = new WindowsAPI.Input {
            Type = WindowsAPI.InputType.Keyboard,
            Data = {
              Keyboard = new WindowsAPI.KeyboardInput {
            KeyCode = (UInt16) keyCode,
            Scan = 0,
            Flags = (uint)WindowsAPI.KeyEvent.KeyUp,
            Time = 0,
            ExtraInfo = IntPtr.Zero
              }
            }
              };

              _input.Add(key);
        }