public void plotData(double data) { if (arduino.IsOpen) { if (this.chart1.InvokeRequired == true) { SetTextCallback d = new SetTextCallback(plotData); this.Invoke(d, new object[] { data }); } else { if (data < 100) { this.chart1.Series[0].Points.Add(data); this.textBox1.Text = Math.Round(data, 2).ToString(); this.chart1.Update(); } else { // Do nothing } } } }
private void SetText() { if (UpTxt.InvokeRequired) { updateDelegate = new SetTextCallback(SetText); try { Invoke(updateDelegate); } catch (System.ObjectDisposedException e) { Console.WriteLine("Caught exception: " + e.StackTrace); } } else { NET.Lock.WaitOne(); float sumU = 0; float sumD = 0; foreach(NetworkAdapter adapter in NET.NetworkAdapters){ if (adapter.PhysicalAdapter) { sumU += adapter.KBSSentFloat; sumD += adapter.KBSRecievedFloat; } } UpTxt.Text = sumU.ToString("0.00 KB/s"); DownTxt.Text = sumD.ToString("0.00 KB/s"); NET.Lock.Release(); } }
private void SetText() { if (TimeHMTxt.InvokeRequired) { updateDelegate = new SetTextCallback(SetText); try { Invoke(updateDelegate); } catch (System.ObjectDisposedException e) { Console.WriteLine("Caught exception: " + e.StackTrace); } } else { Sys.Lock.WaitOne(); TimeHMTxt.Text = Sys.TimeHM; TimeSTxt.Text = Sys.TimeS; DateTxt.Text = Sys.Date; DayTxt.Text = Sys.Day; Sys.Lock.Release(); } }
public Form_Display() { delegte1 = new SetTextCallback(SetText1); InitializeComponent(); btn_port.Text = "&Connect"; // add in the available com ports foreach (string s in SerialPort.GetPortNames()) { this.comboBox1.Items.Add(s); } if (comboBox1.Items.Count == 0) { comboBox1.Items.Add("NO PORT"); this.comboBox1.SelectedIndex = 0; btn_port.Enabled = false; comboBox1.Enabled = false; } else { try { this.comboBox1.SelectedIndex = Properties.Settings.Default.comport; } catch { this.comboBox1.SelectedIndex = 0; } } }
public void UpdateMouse() { if (this.m_Windows[0].InvokeRequired) { SetTextCallback d = new SetTextCallback(UpdateMouse); this.m_Windows[0].Invoke(d, new object[] { }); } else { //Position.X = (float)m_Windows[0].Location.X; //Position.Y = (float)m_Windows[0].Location.Y; //Direction.X = (Cursor.Position.X + 10) - Position.X; //Direction.Y = (Cursor.Position.Y + 10) - Position.Y; //float length = (float)Math.Sqrt(Math.Pow(Direction.X, 2) + Math.Pow(Direction.Y, 2)); //if (length != 0) //{ // Direction.X = Direction.X / length; // Direction.Y = Direction.Y / length; //} //Position.X += Direction.X * Speed; //Position.Y += Direction.Y * Speed; //m_Windows[0].Location = new Point((int)Position.X, (int)Position.Y); m_Windows[0].Location = new Point(Cursor.Position.X + 10, Cursor.Position.Y + 10); m_Windows.Add(m_Windows[0]); m_Windows.RemoveAt(0); } }
private void SetText(string text) { if (textBox1.InvokeRequired) { var d = new SetTextCallback(SetText); Invoke(d, new object[] { text }); } else { textBox1.AppendText(text); } }
void Proxy_Client_0x06DoubleClick(UOProxy.Packets.FromClient._0x06DoubleClick e) { if (this.textBox1.InvokeRequired) { string text = e.Serial + "EUO: " + UOProxy.Helpers.Serial.IntToEUO(e.Serial); SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } }
public void received(String data) { if (this.txtReceived.InvokeRequired) {// ���̲߳�������ʱ��Ҫ���ûص���ʽ SetTextCallback d = new SetTextCallback(received); this.Invoke(d, new object[] { data }); } else { txtReceived.Text += "\r\n���� " + data; } }
/// <summary> /// Threadsave Text Property setter /// </summary> /// <param name="control"></param> /// <param name="text"></param> public static void SetText(Control control, string text) { if(control.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); control.Invoke(d, new object[] { control, text }); } else { control.Text = text; } }
protected virtual void changeButtons() { if (button_search.InvokeRequired) { SetTextCallback d = new SetTextCallback(changeButtons); button_search.Invoke(d, new object[] { }); } else { button_search.Visible = true; button_cancelSearch.Visible = false; } }
public void Output(string message) { if (this.messageLog.InvokeRequired) { SetTextCallback d = new SetTextCallback(Output); this.Invoke(d, new object[] { message }); } else { messageLog.Items.Add(message); } }
public void SetDebugText( string text) { if (laDebug.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetDebugText); this.Invoke(d, new object[] { text }); } else laDebug.Text = text; }
private void MIDIMessageReceived(object sender, MidiInMessageEventArgs e) { if (e.MidiEvent is NoteEvent) { this.Note = new NoteID(((NoteEvent)e.MidiEvent).NoteNumber+1); SetTextCallback d = new SetTextCallback(SetPitchBoxText); this.Invoke(d, new object[] { ((NoteEvent)e.MidiEvent).NoteName }); } }
private void SetStatus(string status) { if (lblStatus.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetStatus); Invoke(d, new object[] { status }); } else lblStatus.Text = status; }
/// <summary> /// Writes a line to the textbox. Automaticall adds newline character /// </summary> /// <param name="text"></param> public void WriteLine(string text, ChatIcon icon = ChatIcon.Default) { if (tb.InvokeRequired) { SetTextCallback d = new SetTextCallback(WriteLine); try { tb.Parent.Invoke(d, new object[] { text, icon }); } catch { } } else { Bitmap chatIcon = null; switch (icon) { case ChatIcon.Sc2Tv: chatIcon = Properties.Resources.sc2icon; break; case ChatIcon.TwitchTv: chatIcon = Properties.Resources.twitchicon; break; case ChatIcon.Steam: chatIcon = Properties.Resources.steamicon; break; case ChatIcon.Skype: chatIcon = Properties.Resources.skypeicon; break; case ChatIcon.Admin: chatIcon = Properties.Resources.adminicon; break; case ChatIcon.Goodgame: chatIcon = Properties.Resources.goodgameicon; break; case ChatIcon.Battlelog: chatIcon = Properties.Resources.bf3icon; break; default: chatIcon = null; break; } if( tb.Text.Length > 0 ) tb.AppendText(Environment.NewLine); if (text != null) { tb.AppendText(DateTime.Now.GetDateTimeFormats('T')[0] + " "); if(chatIcon != null) tb.InsertImage( chatIcon ); tb.AppendText(" " + text); } tb.ScrollToEnd(); } }
public void Error(string message) { if (this.messageLog.InvokeRequired) { SetTextCallback d = new SetTextCallback(Output); this.Invoke(d, new object[] { message }); } else { messageLog.Items.Add("ERROR:: " + message); messageLog.SelectedIndex = messageLog.Items.Count - 1; } }
public void IncrementProcess() { if (this.progressBar1.InvokeRequired) { SetTextCallback d = new SetTextCallback(IncrementProcess); this.Invoke(d, new object[] { }); } else { dataGridView1.ClearSelection(); int numIndex = progressBar1.Value - 1; if (this.progressBar1.Value < this.progressBar1.Maximum) { dataGridView1.Rows[progressBar1.Value].Selected = true; this.progressBar1.Value += 1; } else { numIndex = progressBar1.Value - 1; this.button1.Enabled = true; this.comboBox1.Enabled = true; } this.lblTotal.Text = progressBar1.Value + " / " + progressBar1.Maximum; try { dataGridView1.Rows[numIndex].ErrorText = Common.strMessage; switch (Common.LastProcessResult) { case Common.ProcessResult.Processed: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.Silver; break; case Common.ProcessResult.Ok1: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.Yellow; break; case Common.ProcessResult.Ok2: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.LightGreen; break; case Common.ProcessResult.Added: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.LightBlue; break; case Common.ProcessResult.Error: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.Orange; break; case Common.ProcessResult.Closed: dataGridView1.Rows[numIndex].DefaultCellStyle.BackColor = Color.LightSalmon; break; } //dataGridView1.Rows[numIndex].Selected = true; } catch (Exception) { } } }
public Form1() { InitializeComponent(); setTextCallback = new SetTextCallback(mavLinkTextBoxSetText); //setTextCallback = new SetTextCallback(SetText); string[] theSerialPortNames = System.IO.Ports.SerialPort.GetPortNames(); comPortComboBox.Items.AddRange(theSerialPortNames); comPortComboBox.Items.Add("TCP"); comPortComboBox.Items.Add("UDP"); baudRateComboBox.Items.AddRange(baudRates); }
protected virtual void setGUIText() { if (label_NumResults.InvokeRequired) { SetTextCallback d = new SetTextCallback(setGUIText); label_NumResults.Invoke(d, new object[] { }); } else { label_NumResults.Text = listBox_SearchResults.Items.Count + " Matches Found"; label_Timer.Text = "in " + timer.Elapsed.TotalSeconds + " seconds"; progressBar_Searching.Value = 100; } }
private void outputText(string text) { if (this.rtb_CompressedCode.InvokeRequired) { SetTextCallback d = new SetTextCallback(outputText); this.Invoke(d, new object[] { text }); } else { this.rtb_CompressedCode.Text += text; } }
void SetMainText(string value) { if (this.label1.InvokeRequired) { SetTextCallback t = new SetTextCallback(SetMainText); this.Invoke(t, new object[] {value}); } else { label1.Text = value; } }
private void SetTextSafely(Control ctrl, string text) { if (ctrl.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetTextSafely); this.Invoke(d, new object[] { ctrl, text }); } else { ctrl.Text = text; } }
// Delegando a execução do método que seta a mensagem. // Método que seta a mensagem. public void SetText(string text) { if (ListServerInformations.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); Invoke(d, new object[] { text }); } else { ListServerInformations.Items.Add(text); } }
private void SetText4(string text) { if (this.textBox4.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText4); this.Invoke(d, new object[] { text }); } else { this.textBox4.Text = text; } }
private void DoCounterA(string text) { if (this.counterATextbox.InvokeRequired) { SetTextCallback callbackA = new SetTextCallback(DoCounterA); this.Invoke(callbackA, new object[] { text }); } else { this.counterATextbox.Text = text; } }
// to access the text box in a thread safe manner public void SetText(string text, Control ctrl) { if (ctrl.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); ctrl.Invoke(d, new object[] { text, ctrl }); } else { ctrl.Text = text; } }
void AsyncSetText(string text) { if (this.txbComment.InvokeRequired)//是否是控件本身线程,如果是则返回false,如果不是返回true { SetTextCallback d = new SetTextCallback(AsyncSetText); this.Invoke(d, new object[] { text }); } else { this.txbComment.Text += text; } }
public void addLine(string line) { if (this.textBox1.InvokeRequired) { SetTextCallback d = new SetTextCallback(addLine); this.Invoke(d, new object[] { line }); } else { this.textBox2.Text += line + "\n"; } }
public SKoreLabel() { SetStyle((ControlStyles)2050, true); DoubleBuffered = true; BackColor = Color.White; _setText = new SetTextCallback(SetText); _animateTimer = new System.Timers.Timer(_animationInterval); _animateTimer.SynchronizingObject = this; _animateTimer.Elapsed += DoAnimation; }
private void SetText(string text) { if (this.richTextBox1.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { this.richTextBox1.Text += text; } }
/// <summary> /// Set text property of various controls /// </summary> /// <param name="f">The calling form</param> /// <param name="c"></param> /// <param name="text"></param> public static void SetText(Form f, Control 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 (c.InvokeRequired) { var d = new SetTextCallback(SetText); f.Invoke(d, f, c, text); } else { c.Text = text; } }
/// <summary> /// /// </summary> /// <param name="text"></param> public void SetMainTime(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 (MainTextArea.InvokeRequired) { SetTextCallback d = SetMainTime; Invoke(d, text); } else { MainTextArea.Text += text; } }
/// <summary> /// The set text. /// </summary> /// <param name="text"> /// The text. /// </param> public void SetScanText(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 (MainTextArea.InvokeRequired) { var d = new SetTextCallback(SetScanText); Invoke(d, text); } else { richTextBox1.Text += text; } }
public void SetText(string text) { if (debug) { if (this.textBox.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { this.textBox.AppendText(text + Environment.NewLine); } } }
/// <summary> /// Escribe el texto recibido en el TextBox correspondiente. /// </summary> /// <param name="text">Texto recibido.</param> private void SetTextoRecibido(string text) { if (tBMensajes.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetTextoRecibido); this.Invoke(d, new object[] { text }); } else { string mensajes = text; mensajes += this.tBMensajes.Text; this.tBMensajes.Text = mensajes; Cursor.Current = Cursors.Default; } }
private void Set_temp_default(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.lbl_nhietdothucte.InvokeRequired) { SetTextCallback d = new SetTextCallback(Set_temp_default); this.Invoke(d, new object[] { text }); } else { this.lbl_nhietdothucte.Text = text; } }
private void SetStatusKursi(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.textBox8.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetStatusKursi); this.Invoke(d, new object[] { text }); } else { this.textBox8.Text = text; } }
//======================================================================= /// <summary> /// Display a reply from the server /// </summary> /// <param name="text"></param> private void SetStatus(string text) { string s = text; if (this.labStatus.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetStatus); this.Invoke(d, new object[] { text }); } else { this.labStatus.Text = "<" + s + ">"; LogMessage(s); } }
private void SetText(string text) { if (this.richTextBox1.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { this.richTextBox1.Text = this.richTextBox1.Text + " "; this.richTextBox1.Text = this.richTextBox1.Text + text; } }
public void SetText(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) { SetTextCallback d = new SetTextCallback(SetText); control.Invoke(d, new object[] { control, text }); } else { control.Text = text; } }
private void Set_nhietdo_gia_lap(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.nhietdo_gialap.InvokeRequired) { SetTextCallback d = new SetTextCallback(Set_nhietdo_gia_lap); this.Invoke(d, new object[] { text }); } else { this.nhietdo_gialap.Text = text; } }
/////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region METHODS /// <summary> /// Thread safe sets the Description of the <see cref="lblDescription"/> /// </summary> /// <param name="header">A <see cref="String"/> with the new header.</param> private void SetDescription(string header) { // 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.lblDescription.InvokeRequired) { SetTextCallback d = new SetTextCallback(this.SetDescription); this.lblDescription.BeginInvoke(d, new object[] { header }); } else { this.lblDescription.Text = header; } }
public void setStatusText(string Data) { try { if (statusStrip1.InvokeRequired) { SetTextCallback methodcalling = new SetTextCallback(setStatusText); statusStrip1.Invoke(methodcalling, new object[] { Data }); } else { string destination = Data[0].ToString(); string theData = Data.Substring(1); switch (destination) { case "1": { toolStripStatusLabel1.Text = theData + " | "; break; } case "2": { toolStripStatusLabel2.Text = theData + " | "; break; } case "3": { toolStripStatusLabel3.Text = theData; break; } default: { toolStripStatusLabel1.Text = Data; break; } } } } catch { } }
private void ReadPos_tick(object sender, System.Timers.ElapsedEventArgs e) { double xPos = 0; double yPos = 0; double zPos = 0; double rPos = 0; NMC.HardwareGetCurPos((int)Axis.X, ref xPos); NMC.HardwareGetCurPos((int)Axis.Y, ref yPos); NMC.HardwareGetCurPos((int)Axis.Z, ref zPos); NMC.HardwareGetCurPos((int)Axis.R, ref rPos); NMC.HardwareChklimit(); // xPos = Math.Round(xPos, 2); // yPos = Math.Round(yPos, 2); // zPos = Math.Round(zPos, 2); SetTextCallback xPosition = new SetTextCallback(SetXposText); try { this.Invoke(xPosition, new object[] { Convert.ToString(xPos) }); } catch { } SetTextCallback yPosition = new SetTextCallback(SetYposText); try { this.Invoke(yPosition, new object[] { Convert.ToString(yPos) }); } catch { } SetTextCallback zPosition = new SetTextCallback(SetZposText); //用于动态的更改控件text的内容 try { this.Invoke(zPosition, new object[] { Convert.ToString(zPos) }); } catch { } SetTextCallback rPosition = new SetTextCallback(SetRposText); //用于动态的更改控件text的内容 try { this.Invoke(rPosition, new object[] { Convert.ToString(rPos) }); } catch { } }
private void SetText(string text) { if (this.receiveTxtbx.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { this.receiveTxtbx.Text = this.receiveTxtbx.Text + text; if (receiveTxtbx.Text == "Counter Disconnected.") { ns.Close(); t.Abort(); client.Close(); connecttocounterBttn.Text = "Connect To Counter"; connecttocounterBttn.Enabled = true; receiveTxtbx.Clear(); MessageBox.Show("Counter Disconnected!", "Disconnected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { foreach (string line in receiveTxtbx.Lines) { ordereditemsLstbx.Items.Add(line); } for (int n = 0; n < namelist.Count(); n++) { UpdateInventory(namelist[n], CheckInventory(namelist[n], quantitylist[n]) - quantitylist[n]); UpdateInventoryLog(namelist[n], quantitylist[n]); UpdateInventoryNotifications(namelist[n], CheckInventory(namelist[n], quantitylist[n])); } WriteToOrderQueue(); namelist = null; quantitylist = null; receiveTxtbx.Clear(); ordereditemsLstbx1.Items.Clear(); send1Txtbx.Clear(); finishBttn.Enabled = true; clearBttn.Enabled = false; } } }
private void DisableInterface(string text) { if (this.richMessage.InvokeRequired) { SetTextCallback d = new SetTextCallback(DisableInterface); this.Invoke(d, new object[] { text }); } else { this.richMessage.Clear(); richMessage.Enabled = false; btnEncrypt.Enabled = false; btnSend.Enabled = false; btnNotifications.Enabled = false; } }
public void settext(Control ctl, String str) { try { if (this.InvokeRequired) { SetTextCallback s = new SetTextCallback(settext); this.Invoke(s, ctl, str); } else { ctl.Text = str; } } catch { } }
/// <summary> /// 设置显示当前播放的音乐名称 /// </summary> /// <param name="str"></param> private void SetPlayNow(string str) { try { if (this.Music_Length.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetPlayNow); this.Invoke(d, new object[] { str }); } else { this.Music_Now.Text = str; } } catch { }; }
private void SetText(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 (FormSkin.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); FormSkin.Invoke(d, new object[] { text }); } else { FormSkin.Text = text; FormSkin.Refresh(); } }
private void GetValue(string name, int all, int processed) { if (rtbLog.InvokeRequired) { SetTextCallback d = GetValue; rtbLog.Invoke(d, name, all, processed); } else { Application.DoEvents(); rtbLog.AppendText($"{name} {all} {processed} \r\n"); rtbLog.SelectionStart = rtbLog.TextLength; rtbLog.ScrollToCaret(); } }
/// <summary> /// Set text property of various controls /// </summary> /// <param name="form">The calling form</param> /// <param name="ctrl"></param> /// <param name="checkd"></param> public static void SetText(Form form, Control ctrl, bool checkd) { // 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) { SetTextCallback d = new SetTextCallback(SetText); form.Invoke(d, new object[] { form, ctrl, checkd }); } else { CheckBox chk = (CheckBox)ctrl; chk.Checked = checkd; } }
/// <summary> /// Imprime resultado dos comandos no RichTextBox /// </summary> /// <param name="message"></param> public void Output(string message, bool scroll) { if (this.rtbOutput.InvokeRequired) { SetTextCallback d = new SetTextCallback(Output); this.Invoke(d, new object[] { message, true }); } else { rtbOutput.AppendText(message); // adiciona msg if (scroll) { rtbOutput.ScrollToCaret(); // corre a barra de rolagem para o fim do texto } } }
public WncUdpServer(ref Button bt, ref TextBox tb1, ref TextBox tb2, String localPort, SetTextCallback ff) { port = int.Parse(localPort); client = new UdpClient(port); b = bt; t1 = tb1; t2 = tb2; b.Click += tx; f = ff; Thread th = new Thread(rx); th.Start(); }
private void AppendOutputText(string text) { if (lblOutput.InvokeRequired) { SetTextCallback textCallback = new SetTextCallback(AppendOutputText); Invoke(textCallback, new object[] { text }); } else { if (GetNumberOfStringInString(lblOutput.Text, '\n') > 15) { lblOutput.Text = RemoveLinesFromString(lblOutput.Text, 1); } lblOutput.Text += text; } }
public void ErrorChat(String text) { Running = false; if (textBoxPassword.InvokeRequired) { SetTextCallback d = new SetTextCallback(ErrorChat); textBoxPassword.Invoke(d, new object[] { text }); textBoxUsername.Invoke(d, new object[] { text }); } else { this.textBoxPassword.Text = text; this.textBoxUsername.Text = text; } }
private void SetTextBoxsh(string text) { //text = text.Remove(text.Length); if (this.textBoxsh.InvokeRequired) { if (!this.textBoxsh.IsDisposed) { SetTextCallback d = new SetTextCallback(SetTextBoxsh); this.Invoke(d, new object[] { text }); } } else { this.textBoxsh.Text = text; } }
private void SetText(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.lbConnections.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); this.Invoke(d, new object[] { text }); } else { lbConnections.Items.Add(text); // this.lbConnections.Text = text; } }
private void SetText(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.txtChatBox.InvokeRequired) { SetTextCallback c = new SetTextCallback(SetText); this.Invoke(c, new Object[] { text }); } else { this.txtChatBox.Text += text; } }
private void SetReceiveCountLabel(string text) { try { if (ReceiveCount_Label.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetReceiveCountLabel); this.Invoke(d, text); } else { ReceiveCount_Label.Text = text; } } catch { } }
/// <summary> /// Show changes of present value in simulator via COV into the UI /// </summary> /// <param name="fsCOVPresentValue"></param> private void COVChangesToUI(string fsCOVPresentValue) { //// 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.lblCurrentLightLevelValue.InvokeRequired) { SetTextCallback loSetTextCallback = new SetTextCallback(COVChangesToUI); this.Invoke(loSetTextCallback, new object[] { fsCOVPresentValue }); } else { this.lblCurrentLightLevelValue.Text = fsCOVPresentValue; this.trackBarLightingLevel.Value = Convert.ToInt32(fsCOVPresentValue); } }