コード例 #1
0
        public KeyboardKeyTester(TestDevice device, AhkKey key, bool block = false)
        {
            Console.WriteLine($"Test key: {key.Name} - code {key.LogCode()}");
            var im = new Manager();

            var devId = device.GetDeviceId();

            if (devId == 0)
            {
                return;
            }

            im.SubscribeKey(devId, 0x2, block, new Action <int>(OnKeyEvent));
        }
コード例 #2
0
        public SetStateTester(TestDevice device, AhkKey key)
        {
            Console.WriteLine($"Test key: {key.Name} - code {key.LogCode()}");
            Console.WriteLine("Enter to toggle Subscription state");
            var im    = new Manager();
            var devId = device.GetDeviceId();

            if (devId == 0)
            {
                return;
            }
            var state = true;

            im.SubscribeKey(devId, key.Code, true, new Action <int>(OnKeyEvent));

            while (true)
            {
                Console.ReadLine();
                state = !state;
                Console.WriteLine($"SetState({state})");
                im.SetState(state);
            }
        }