private void SetText(string t) { if (textBox1.InvokeRequired) { SetCallBack d = SetText; this.Invoke(d, new object[] { t }); } else { textBox1.Text = t; } }
/// <summary> /// /// </summary> /// <param name="t"></param> private void SetText(string t) { if (txtBarcode.InvokeRequired) { SetCallBack d = SetText; Invoke(d, t); } else { txtBarcode.Text = t; } }
private void CallBack(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) { SetCallBack d = new SetCallBack(CallBack); this.Invoke(d, new object[] { text }); } else { this.listBox2.Items.Add(text); } }// This event handler starts the form's// BackgroundWorker by calling RunWorkerAsync.// The Text property of the TextBox control is set// when the BackgroundWorker raises the RunWorkerCompleted// event.
private void SetlistResult(object item) { if (listBoxResult.InvokeRequired) { var call = new SetCallBack(SetlistResult); Invoke(call, item); } else { AddListResult(item); } }
void debug(string msg) { if (lst_box.InvokeRequired == true) { SetCallBack d = new SetCallBack(SetTextinListBox); lst_box.Parent.Invoke(d, new Object[] { msg }); } else { SetTextinListBox(msg); } }
public override void onMetronomeEvent(object sender, metronomeEventArgs e) { if (spinBox.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(IncrementSpinBox); metronome.mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke spinBox.Value++; } }
/// <summary> /// Draw the graphical view to the panel /// </summary> public override void Draw() { if (pGraphical.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(gDisplay.Draw); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke gDisplay.Draw(); } }
/// <summary> /// Draw data to listbox /// </summary> public override void Draw() { if (dgvStatistics.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawStatistics); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawStatistics(); } }
/// <summary> /// Update status bar no information from the main simulation is used /// </summary> public override void Update(Calender calender, ResourceManager resourceMananger, Statistics statistics) { if (pBar.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(UpdateProgress); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke pBar.Value = Global.Clock; } }
public override void onMetronomeEvent(object sender, metronomeEventArgs e) { DateTime currDateTime = e.currentTime; if (listBox.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(AddTimeStamp); metronome.mainForm.Invoke(d, currDateTime.ToString()); } else { listBox.Items.Add(currDateTime.ToString()); } }
/// <summary> /// Draw the datagrid views with updated information /// </summary> public override void Draw() { if (dgvCalender.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawCalender); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawCalender(); } if (dgvOtherQueue.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawOtherQueue); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawOtherQueue(); } if (dgvCarStereoQueue.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawCarStereoQueue); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawCarStereoQueue(); } }
public static void GetCallBack(Object frm, object rdata) { Forms.MainForm Form = (Forms.MainForm)frm; if (Form.InvokeRequired) { //AsyGet //getip GetMain.Get_IP(Form.textBox1.Text, Form.textBox2.Text); GetMain.GetDns_Whitelist(Form.textBox3.Text); string result = GetMain.ipresult; //getpac_dns_whitelist SetCallBack scb = new SetCallBack(GetCallBack); if (Form.IsHandleCreated) { Form.Invoke(scb, new object[] { Form, null }); } } else { Form.btn_Get.Enabled = true; Form.btn_save.Enabled = true; } }
public static extern void IPCAST_SetCallBack(SetCallBack pFunc);
/// <summary> /// Draw data to listbox /// </summary> public override void Draw() { if (dgvStatistics.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawStatistics); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawStatistics(); } }
/// <summary> /// Update status bar no information from the main simulation is used /// </summary> public override void Update(Calender calender, ResourceManager resourceMananger, Statistics statistics) { if (pBar.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(UpdateProgress); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke pBar.Value = Global.Clock; } }
public override void onMetronomeEvent(object sender, metronomeEventArgs e) { DateTime currDateTime = e.currentTime; if (listBox.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(AddTimeStamp); metronome.mainForm.Invoke(d, currDateTime.ToString()); } else { listBox.Items.Add(currDateTime.ToString()); } }
public override void onMetronomeEvent(object sender, metronomeEventArgs e) { if (spinBox.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(IncrementSpinBox); metronome.mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke spinBox.Value++; } }
void debug(string msg) { if (lst_box.InvokeRequired == true) { SetCallBack d = new SetCallBack(SetTextinListBox); lst_box.Parent.Invoke(d, new Object[] { msg }); } else { SetTextinListBox(msg); } }
/// <summary> /// Draw the datagrid views with updated information /// </summary> public override void Draw() { if (dgvCalender.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawCalender); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawCalender(); } if (dgvOtherQueue.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawOtherQueue); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawOtherQueue(); } if(dgvCarStereoQueue.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(DrawCarStereoQueue); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke DrawCarStereoQueue(); } }
/// <summary> /// Draw the graphical view to the panel /// </summary> public override void Draw() { if (pGraphical.InvokeRequired) { // It's on a different thread, so use Invoke. SetCallBack d = new SetCallBack(gDisplay.Draw); mainForm.Invoke(d); } else { // It's on the same thread, no need for Invoke gDisplay.Draw(); } }