Beispiel #1
0
        private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = _serialPort;
            string     indata = sp.ReadExisting(); // readLine

            Debug.WriteLine(indata.Length);
            this.Dispatcher.Invoke(() =>
            {
                Debug.WriteLine(indata);
                TextBox1.Text += indata;
                TextBox1.ScrollToEnd();
            });
        }
Beispiel #2
0
        private void GetClipboardData()
        {
            if (Clipboard.ContainsText())
            {
                var cliptext = Clipboard.GetText(TextDataFormat.Text);
                if (cliptext != lastText)
                {
                    lastText = cliptext;

                    Dispatcher.Invoke(() =>
                    {
                        TextBox1.Text += "------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine;
                        TextBox1.Text += cliptext + Environment.NewLine;
                        TextBox1.ScrollToEnd();
                    });
                }
            }
        }
Beispiel #3
0
 private void TextBox1_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     TextBox1.ScrollToEnd();
     AllowUIToUpdate();
 }