Exemplo n.º 1
0
        public override void Invoke()
        {
            Up.Clear();
            bool inputexists = false;

            foreach (var key in Input)
            {
                inputexists = true;
                break;
            }
            if (inputexists)
            {
                Up.AddRange(Pressed);
            }
            else
            {
                Up.AddRange(Pressed.Where(k => Input.All(kk => k.KeyCode != kk.KeyCode)));
            }

            Down.Clear();
            if (Pressed.Count == 0)
            {
                Down.AddRange(Input);
            }
            else
            {
                Down.AddRange(Input.Where(k => Pressed.All(kk => k.KeyCode != kk.KeyCode)));
            }

            Pressed.Clear();
            Pressed.AddRange(Input);

            Execute = Enabled && (Up.Count > 0 || Down.Count > 0);
            base.Invoke();
        }