/// <summary>
 /// Invoke user call backs
 /// </summary>
 /// <param name="kd"></param>
 private static void KListener_KeyDown(KeyData kd)
 {
     OnKeyInput?.Invoke(null, new KeyInputEventArgs()
     {
         KeyData = kd
     });
 }
Exemple #2
0
 public void KeyInput(string input)
 {
     if (OnKeyInput != null)
     {
         OnKeyInput.Invoke(this, input);
     }
 }
 private void KeyGeter_KeyDown(KeyInfo ki)
 {
     OnKeyInput?.Invoke(null, new KeyInputHookEventArgs()
     {
         Key = ki
     });
 }
        public void RegisterKeyUp(OnKeyInput _node)
        {
            if (onKeyUpInputs == null)
            {
                onKeyUpInputs = new List <OnKeyInput>();
            }

            onKeyUpInputs.Add(_node);
        }
Exemple #5
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
                });
            }
        }
Exemple #6
0
 public void KeyInput(UIKeyEvent e)
 {
     OnKeyInput?.Invoke(e, this);
 }