Ejemplo n.º 1
0
        private async void button1_Click(object sender, RoutedEventArgs e)
        {
            string s  = "Start";
            string sp = "Stop";

            Random rnd = new Random();

            char[] charArray = new char[] { 'W', 'Q', 'E', ' ' };

            if (button1.Content.ToString() == s)
            {
                button1.Background = Brushes.SeaGreen;
                button1.Content    = sp;

                do
                {
                    await System.Threading.Tasks.Task.Delay(3000);

                    SimKeyboard.Press((byte)charArray[rnd.Next(0, charArray.Length)]);
                    tb1.Text = (Int32.Parse(tb1.Text) + 1).ToString();
                }while (button1.Content.ToString() == sp);

                tb1.Text = (Int32.Parse("0")).ToString();
            }

            else

            {
                button1.Content    = s;
                button1.Background = Brushes.GhostWhite;
            }
        }
Ejemplo n.º 2
0
 private void TypeASDF_Click(object sender, RoutedEventArgs e)
 {
     this.TextEntry.Focus();
     SimKeyboard.Press((byte)'A');
     SimKeyboard.Press((byte)'S');
     SimKeyboard.Press((byte)'D');
     SimKeyboard.Press((byte)'F');
 }