static KeyboardEventDispatcher()
 {
     //Get All The Modifiers In The Beginning
     Modifiers = new ModifierList();
     Modifiers.CapsLockState = Control.IsKeyLocked(WinKeys.CapsLock);
     Modifiers.NumLockState = Control.IsKeyLocked(WinKeys.NumLock);
     Modifiers.ScrollLockState = Control.IsKeyLocked(WinKeys.Scroll);
     RefreshModfiers();
     OnKeyPressed +=
         (sender, args) => {
             switch(args.KeyCode) {
                 case Keys.CapsLock: Modifiers.CapsLockState = !Modifiers.CapsLockState; return;
                 case Keys.Scroll: Modifiers.ScrollLockState = !Modifiers.ScrollLockState; return;
                 case Keys.NumLock: Modifiers.NumLockState = !Modifiers.NumLockState; return;
             }
         };
 }
Ejemplo n.º 2
0
        static KeyboardEventDispatcher()
        {
            //Get All The Modifiers In The Beginning
            Modifiers = new ModifierList();
            Modifiers.CapsLockState   = Control.IsKeyLocked(WinKeys.CapsLock);
            Modifiers.NumLockState    = Control.IsKeyLocked(WinKeys.NumLock);
            Modifiers.ScrollLockState = Control.IsKeyLocked(WinKeys.Scroll);
            RefreshModfiers();
            OnKeyPressed +=
                (sender, args) => {
                switch (args.KeyCode)
                {
                case Keys.CapsLock: Modifiers.CapsLockState = !Modifiers.CapsLockState; return;

                case Keys.Scroll: Modifiers.ScrollLockState = !Modifiers.ScrollLockState; return;

                case Keys.NumLock: Modifiers.NumLockState = !Modifiers.NumLockState; return;
                }
            };
        }