private void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (_subscriber == null)
     {
         return;
     }
     if (char.IsControl(e.Character))
     {
         if (e.Character == '\u0016')
         {
             Thread thread = new Thread(PasteThread);
             thread.SetApartmentState(ApartmentState.STA);
             thread.Start();
             thread.Join();
             _subscriber.RecieveTextInput(_pasteResult);
         }
         else
         {
             _subscriber.RecieveCommandInput(e.Character);
         }
     }
     else
     {
         _subscriber.RecieveTextInput(e.Character);
     }
 }
Exemplo n.º 2
0
 public void Poll()
 {
     if (_enteredText != null)
     {
         if (_subscriber != null && !ShouldSuppress())
         {
             _subscriber.RecieveTextInput(_enteredText);
         }
         _enteredText = null;
     }
     if (_charsEntered.Count > 0)
     {
         if (_subscriber != null && !ShouldSuppress())
         {
             foreach (char key3 in _charsEntered)
             {
                 _subscriber.RecieveTextInput(key3);
             }
         }
         _charsEntered.Clear();
     }
     if (_commandInputs.Count > 0)
     {
         if (_subscriber != null && !ShouldSuppress())
         {
             foreach (char key2 in _commandInputs)
             {
                 _subscriber.RecieveCommandInput(key2);
             }
         }
         _commandInputs.Clear();
     }
     if (_keysDown.Count <= 0)
     {
         return;
     }
     if (_subscriber != null && !ShouldSuppress())
     {
         foreach (Keys key in _keysDown)
         {
             _subscriber.RecieveSpecialInput(key);
         }
     }
     _keysDown.Clear();
 }
Exemplo n.º 3
0
        private void EventInput_CharEntered(object sender, CharacterEventArgs e)
        {
            char ch = e.Character;
            IKeyboardSubscriber subscriber = Game1.keyboardDispatcher.Subscriber;

            if (subscriber != null)
            {
                if (!char.IsControl(ch))
                {
                    subscriber.RecieveTextInput(ch);
                }
                else if (ch == '\u0016')//paste
                {
                    if (System.Windows.Forms.Clipboard.ContainsText())
                    {
                        subscriber.RecieveTextInput(System.Windows.Forms.Clipboard.GetText());
                    }
                }
                else
                {
                    subscriber.RecieveCommandInput(ch);
                }
            }
        }