コード例 #1
0
 public void KeyInput(string input)
 {
     if (OnKeyInput != null)
     {
         OnKeyInput.Invoke(this, input);
     }
 }
コード例 #2
0
 /// <summary>
 /// Invoke user call backs
 /// </summary>
 /// <param name="kd"></param>
 private static void KListener_KeyDown(KeyData kd)
 {
     OnKeyInput?.Invoke(null, new KeyInputEventArgs()
     {
         KeyData = kd
     });
 }
コード例 #3
0
 private void KeyGeter_KeyDown(KeyInfo ki)
 {
     OnKeyInput?.Invoke(null, new KeyInputHookEventArgs()
     {
         Key = ki
     });
 }
コード例 #4
0
        /// <summary>
        ///     Consume events from the producer queue asynchronously
        ///     消费者:从异步队列取出记录,Invoke调用上层用户的响应函数
        ///     注意,这是个异步函数(async)
        /// </summary>
        /// <returns></returns>
        private async Task ConsumeKeyAsync()
        {
            while (isRunning)
            {
                //blocking here until a key is added to the queue
                var item = await keyQueue.DequeueAsync();

                if (item is bool)
                {
                    break;
                }

                //KListener_KeyDown(item);
                OnKeyInput?.Invoke(null, new KeyInputEventArgs {
                    KeyData = (KeyData)item
                });
            }
        }
コード例 #5
0
 public void KeyInput(UIKeyEvent e)
 {
     OnKeyInput?.Invoke(e, this);
 }