Exemplo n.º 1
0
 private void addText(string text)
 {
     if (txtOutput.InvokeRequired)
     {
         addTextCallback d = new addTextCallback(addText);
         Invoke(d, new object[] { text });
     }
     else
     {
         txtOutput.AppendText(text);
     }
 }
Exemplo n.º 2
0
        void processData(string data)
        {
            string[] split = data.Split(';');

            switch (split[0])
            {
                case "message":
                    addTextCallback d = new addTextCallback(setText);
                    txt_Output.Dispatcher.Invoke(d,new object[]{split[1]}); //Make a thread safe call to update the textbox
                    break;

            }
        }
Exemplo n.º 3
0
 public void addText(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.textBox1.InvokeRequired)
     {
         addTextCallback d = new addTextCallback(setText);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         if (textBox1.Text.Length > 2000)
             textBox1.Text = "";
         textBox1.Text += text + "\r\n";
         textBox1.SelectionLength = 0;
         textBox1.SelectionStart = textBox1.Text.Length - 1;
         textBox1.ScrollToCaret();
     }
 }
Exemplo n.º 4
0
 public void addText(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.textBox1.InvokeRequired)
     {
         addTextCallback d = new addTextCallback(setText);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         if (textBox1.Text.Length > 2000)
         {
             textBox1.Text = "";
         }
         textBox1.Text           += text + "\r\n";
         textBox1.SelectionLength = 0;
         textBox1.SelectionStart  = textBox1.Text.Length - 1;
         textBox1.ScrollToCaret();
     }
 }
Exemplo n.º 5
0
 private void addText(string text)
 {
     if (AutoStart) {
         Console.WriteLine(DateTime.Now.ToString ("[HH:mm:ss.fff] ") + text);
     } else {
         // InvokeRequired required compares the thread ID of the// calling thread to the thread ID of the creating thread.// If these threads are different, it returns true.if (this.textBox1.InvokeRequired)
         if (this.tbOut.InvokeRequired) {
             addTextCallback d = new addTextCallback (addText);
             this.Invoke (d, new object[] { text });
         } else {
             this.tbOut.AppendText (DateTime.Now.ToString ("[HH:mm:ss.fff] "));
             this.tbOut.AppendText (text);
             this.tbOut.SelectionStart = this.tbOut.Text.Length;
             this.tbOut.ScrollToCaret ();
         }
     }
 }