/// <summary> /// Set text property of various controls /// </summary> /// <param name="form">The calling form</param> /// <param name="control"></param> /// <param name="text"></param> public static void AddText(Form form, Control control, 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 (control.InvokeRequired) { var addTextCallback = new AddTextCallback(AddText); form.Invoke(addTextCallback, form, control, text); } else { #if DEBUG if (control.Text.Length > 100000) #else if (control.Text.Length > 1000) #endif { control.Text = text; } else { control.Text += text; } } }
private void AddText(RichTextBox c, 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.textID.InvokeRequired) try { if (c.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { c, text }); } else { string s = DateTime.Now.ToString() + ": " + text + "\r\n"; c.AppendText(s /*text*/); //c.Text += text; c.SelectionStart = c.Text.Length; c.ScrollToCaret(); } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void AddText(string value, bool bScrollDown) { if (this.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { value, bScrollDown }); } else { // first remove some text if we have reached the max length of the textbox if (value.Length + txtTrace.TextLength > txtTrace.MaxLength) { this.txtTrace.SelectionStart = 0; this.txtTrace.SelectionLength = value.Length; this.txtTrace.SelectedText = ""; } this.txtTrace.AppendText(value); if (bScrollDown) { txtTrace.SelectionStart = txtTrace.Text.Length; txtTrace.ScrollToCaret(); } } }
public void AddText(string text) { /*=====================================================*/ /* If we're attempting to modify the control from a */ /* different thread from the one that created it, then */ /* we need to use Invoke to handle the modification. */ /*=====================================================*/ if (m_RouterTextBox.InvokeRequired) { Form parentForm = m_RouterTextBox.FindForm(); AddTextCallback d = new AddTextCallback(AddText); parentForm.Invoke(d, new object[] { text }); } /*===================================*/ /* Otherwise the thread that created */ /* it can process the modification. */ /*===================================*/ else { m_RouterTextBox.AppendText(text); } }
/***********/ /* AddText */ /***********/ public void AddText(string text) { /*=====================================================*/ /* If we're attempting to modify the control from a */ /* different thread from the one that created it, then */ /* we need to use Invoke to handle the modification. */ /*=====================================================*/ if (!m_RouterTextBox.Dispatcher.CheckAccess()) { AddTextCallback d = new AddTextCallback(AddText); m_RouterTextBox.Dispatcher.Invoke(d, new object[] { text }); } /*===================================*/ /* Otherwise the thread that created */ /* it can process the modification. */ /*===================================*/ else { m_RouterTextBox.AppendText(text); m_RouterTextBox.Select(m_RouterTextBox.Text.Length, m_RouterTextBox.Text.Length); m_RouterTextBox.ScrollToEnd(); } }
/// <summary> /// Adds the message to ListBox /// </summary> /// <param name="text">The text.</param> private void AddInfo(string text) { if (this.infoListBox.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddInfo); this.Invoke(d, new object[] { text }); } else { this.infoListBox.Items.Add(text); } }
private void AddText(FlowLayoutPanel panel, Button box) { if (panel.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, panel, box); } else { panel.Controls.Add(box); } }
public static void AddText(Form form, Control ctrl, string text) { if (ctrl.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); form.Invoke(d, new object[] { form, ctrl, text }); } else { ctrl.Text += text + "\r\n"; } }
private void AddText(string text) { if (listBox1.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); Invoke(d, new object[] { text }); } else { this.listBox1.Items.Add(text); } }
private void addText(Chat_message chat_message) { if (this.textBox1.InvokeRequired) { AddTextCallback d = new AddTextCallback(addText); this.Invoke(d, new object[] { chat_message }); } else { this.textBox1.Text += chat_message; } }
public void AddText(string text) { if (_routerTextBox.InvokeRequired) { Form parentForm = _routerTextBox.FindForm(); AddTextCallback d = new AddTextCallback(AddText); parentForm.Invoke(d, new object[] { text }); } else { _routerTextBox.AppendText(text); } }
/// <summary> /// /// </summary> /// <param name="text"></param> internal void addTextSafely(String text) { if (textBox.InvokeRequired) { //Console.WriteLine("Invoke Required"); AddTextCallback d = new AddTextCallback(addTextSafely); Invoke(d, new object[] { text }); } else { //Console.WriteLine("Invoke NOT Required"); textBox.Text = lineCount++ + "\t" + text + "\r\n" + textBox.Text; Refresh(); } }
private 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.output.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { text }); } else { this.output.AppendText(text); } }
private 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.listStatus.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { text }); } else { this.listStatus.Items.Add(text); } }
public static void AddText(Form form, Control ctrl, 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 (ctrl.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); form.Invoke(d, new object[] { form, ctrl, text }); } else { ctrl.Text += text; } }
private void AddText_To_GridControl(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.dgv_CardData.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText_To_GridControl); this.Invoke(d, new object[] { text }); } else { this.dgv_CardData.Rows.Add(new String[] { DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"), text });; } }
private void AddDebugTextToLog(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.textLog.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddDebugTextToLog); this.Invoke(d, new object[] { text }); } else { if (this.debug_mode) { this.textLog.AppendText(text); } } }
/// <summary> Adds a text to htmlBox </summary> /// /// <param name="text"> The text. </param> private 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.htmlBox.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { text }); } else { //write to rich text box. this.htmlBox.Text += text; //write to log file. this.logFileStreamWriter.Write(text); this.logFileStreamWriter.Flush(); } }
private void AddText(string text) { // Was this call made on the thread that created the listview? if (this.listView1.InvokeRequired) { // If not we need to invoke a delegate on the creating thread // note the recursive call to this method. AddTextCallback d = new AddTextCallback(AddText); this.Invoke(d, new object[] { text }); } else { // The call was made on the creating thread (through invocation // of a delegate this.listView1.Items.Add(text); // Scroll to latest this.listView1.Items[listView1.Items.Count - 1].EnsureVisible(); } }
/***********/ /* AddText */ /***********/ public void AddText(string text) { /*=====================================================*/ /* If we're attempting to modify the control from a */ /* different thread from the one that created it, then */ /* we need to use Invoke to handle the modification. */ /*=====================================================*/ if (! m_RouterTextBox.Dispatcher.CheckAccess()) { AddTextCallback d = new AddTextCallback(AddText); m_RouterTextBox.Dispatcher.Invoke(d, new object[] { text }); } /*===================================*/ /* Otherwise the thread that created */ /* it can process the modification. */ /*===================================*/ else { m_RouterTextBox.AppendText(text); m_RouterTextBox.Select(m_RouterTextBox.Text.Length,m_RouterTextBox.Text.Length); m_RouterTextBox.ScrollToEnd(); } }
private void AddTextToLog(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.lblStatus.InvokeRequired) { AddTextCallback d = new AddTextCallback(AddTextToLog); this.Invoke(d, new object[] { text }); } else { this.lblStatus.Text = text; } }
private void SetText(string text) { if (this.output.InvokeRequired) { AddTextCallback d = new AddTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { startButton.Text = text; } }
private void AddText(string text) { if (this.LogTextBox.InvokeRequired) { AddTextCallback c = new AddTextCallback(AddText); this.Invoke(c, new object[] { text }); } else { this.LogTextBox.AppendText(text); } }