public InputHookWin(InputCombination inputCombination, ProcessFunction imageProcessFunction)
            : base(inputCombination, imageProcessFunction)
        {
            MouseHook_    = new MouseHook();
            KeyboardHook_ = new KeyboardHook();

            MouseHook_.MouseDown  += MouseHook_MouseDown;
            MouseHook_.MouseUp    += MouseHook_MouseUp;
            KeyboardHook_.KeyDown += KeyboardHook_KeyDown;
            KeyboardHook_.KeyUp   += KeyboardHook_KeyUp;

            InputCombination     = inputCombination;
            PressedMouseButtons_ = new Dictionary <MouseButtons, bool>();
            PressedKeyboardKeys_ = new Dictionary <Keys, bool>();
            foreach (var button in InputCombination.MouseButtons)
            {
                PressedMouseButtons_.Add(button, false);
            }
            foreach (var key in InputCombination.KeyboardKeys)
            {
                PressedKeyboardKeys_.Add(key, false);
            }

            MouseHook_.Start();
            KeyboardHook_.Start();
        }
Exemple #2
0
 public InputHook(InputCombination inputCombination, ProcessFunction imageProcessFunction)
 {
     Logger               = LogManager.GetCurrentClassLogger();
     InputCombination     = inputCombination;
     ImageProcessFunction = imageProcessFunction;
 }