private void updateLabelText(string newText)
        {
            if (_output.InvokeRequired)
            {
                // this is worker thread
                updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
                _output.Invoke(del, new object[] { newText });
            }
            else
            {
                if (_output.Text.Length > TextBuffer + 700)
                {
                    _output.Text = _output.Text.Substring(_output.Text.IndexOf("\n", 700));
                }


                // this is UI thread"
                bool scroll = newText.Contains("\n");
                _output.Text += newText.Replace("\n", "");

                //_output.Text = _output.Text.Replace("\n\n", "\r\n");

                _output.SelectionStart = _output.Text.Length;
                //_output.ScrollToCaret();
                if (scroll)
                {
                    _output.SelectionStart = _output.Text.Length;
                    _output.ScrollToCaret();
                    //_output.Select(_output.Text.Length, 1);
                    //_output.ScrollToCaret();
                }
            }
        }
        private void updateLabelText(string newText)
        {
            if (_output.InvokeRequired)
            {
                // this is worker thread
                updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
                _output.Invoke(del, new object[] { newText });
            }
            else
            {

                if (_output.Text.Length > TextBuffer + 700)
                    _output.Text = _output.Text.Substring(_output.Text.IndexOf("\n", 700));

                // this is UI thread"
                bool scroll = newText.Contains("\n");
                _output.Text += newText.Replace("\n", "");

                //_output.Text = _output.Text.Replace("\n\n", "\r\n");

                _output.SelectionStart = _output.Text.Length;
                //_output.ScrollToCaret();
                if (scroll)
                {
                    _output.SelectionStart = _output.Text.Length;
                    _output.ScrollToCaret();
                    //_output.Select(_output.Text.Length, 1);
                    //_output.ScrollToCaret();
                }
            }
        }
Esempio n. 3
0
 public static void UpdateLabelText(Label label, string newText)
 {
     if (label.InvokeRequired)
     {
         updateLabelTextDelegate del = new updateLabelTextDelegate(UpdateLabelText);
         label.Invoke(del, new object[] { label, newText });
     }
     else
     {
         label.Text = newText;
     }
 }
 private void updateLabelText(string newText)
 {
     if (rxtxTB.InvokeRequired)
     {
         // worker thread
         updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
         rxtxTB.Invoke(del, new object[] { newText.Trim() });
     }
     else
     {
         // UI thread
         rxtxTB.Text = newText.Trim();
     }
 }
Esempio n. 5
0
 private void updateLabel10Text(string newText)
 {
     if (label10.InvokeRequired)
     {
         // this is worker thread
         updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabel10Text);
         label10.Invoke(del, new object[] { newText });
     }
     else
     {
         // this is UI thread
         label10.Text = newText;
     }
 }
 private void updateLabelText(string newText,Label l)
 {
     if (l.InvokeRequired) {
             // this is worker thread
             updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
             l.Invoke(del, new object[] { newText, l });
         } else {
             // this is UI thread
             l.Text = newText;
         }
 }