private void SetDeviceState(int devId, bool state)
        {
            if (devId < 11)
            {
                if (state)
                {
                    im.SubscribeKeyboard(devId, _blockingEnabled[devId], new Action <ushort, int>((code, value) =>
                    {
                        var keyObj = AhkKeys.Obj(code);

                        Console.WriteLine($"Name: {keyObj.Name}, Code: {keyObj.LogCode()}, State: {value}");
                    }));
                }
                else
                {
                    im.UnsubscribeKeyboard(devId);
                }
            }
            else
            {
                if (state)
                {
                    im.SubscribeMouseMove(devId, _blockingEnabled[devId], new Action <int, int>((x, y) =>
                    {
                        Console.WriteLine($"Mouse Move: x: {x}, y: {y}");
                    }));
                }
                else
                {
                    im.UnsubscribeMouseMove(devId);
                }
            }
            _deviceStates[devId] = state;
        }
Пример #2
0
        public void OnKeyEvent(ushort code, int value)
        {
            var keyObj = AhkKeys.Obj(code);

            Console.WriteLine($"Name: {keyObj.Name}, Code: {keyObj.LogCode()}, State: {value}");
        }