Пример #1
0
 public void Handle(List <Key> _givenKeys)
 {
     if (matchesRequirements(_givenKeys))
     {
         foreach (Command c in commands)
         {
             c.Execute();
         }
     }
     else
     {
         if (nextKeyChain != null)
         {
             nextKeyChain.Handle(_givenKeys);
         }
     }
 }
Пример #2
0
        public void OnKeyPressed() //This gets called whenever a key gets pressed in the MainWindow, checks if the key that is pressed is a command key.
        {
            RestartThread();

            if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt || (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) // Is Alt key pressed
            {
                foreach (Key k in getPressedKeys())
                {
                    Console.Write(k + " - ");
                }
                Console.WriteLine("____________________________________");
                firstKeyChain.Handle(getPressedKeys());
            }
            else
            {
                target.SetNewState();
            }
        }