コード例 #1
0
        public void CheckWhetherKeyboardGeneratesKeystrokesUsingAPM()
        {
            using (Keyboard _keyboard = new Keyboard())
            {
                List <char> _chars = new List <char>();

                for (int i = 0; i < 3; i++)
                {
                    IAsyncResult asyncResult = _keyboard.BeginReadKeyFromKeyboardBuffer(null, null);
                    _chars.Add(_keyboard.EndReadKeyFromKeyboardBuffer(asyncResult));
                }

                Assert.IsTrue(_chars.Count == 3);
            }
        }