Esempio n. 1
0
 private void SetText(string t)
 {
     if (textBox1.InvokeRequired)
     {
         SetCallBack d = SetText;
         this.Invoke(d, new object[] { t });
     }
     else
     {
         textBox1.Text = t;
     }
 }
Esempio n. 2
0
 /// <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.
Esempio n. 4
0
 private void SetlistResult(object item)
 {
     if (listBoxResult.InvokeRequired)
     {
         var call = new SetCallBack(SetlistResult);
         Invoke(call, item);
     }
     else
     {
         AddListResult(item);
     }
 }
Esempio n. 5
0
 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);
     }
 }
Esempio n. 6
0
 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++;
     }
 }
Esempio n. 7
0
File: Display.cs Progetto: rNdm74/C-
 /// <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();
     }
 }
Esempio n. 8
0
File: Display.cs Progetto: rNdm74/C-
 /// <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();
     }
 }
Esempio n. 9
0
File: Display.cs Progetto: rNdm74/C-
 /// <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;
     }
 }
Esempio n. 10
0
        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());
            }
        }
Esempio n. 11
0
File: Display.cs Progetto: rNdm74/C-
        /// <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;
     }
 }
Esempio n. 13
0
 public static extern void IPCAST_SetCallBack(SetCallBack pFunc);
Esempio n. 14
0
File: Display.cs Progetto: rNdm74/C-
 /// <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();
     }
 }
Esempio n. 15
0
File: Display.cs Progetto: rNdm74/C-
 /// <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;
     }
 }
Esempio n. 16
0
        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());
            }
        }
Esempio n. 17
0
 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++;
     }
 }
Esempio n. 18
0
 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);
     }
 }
Esempio n. 19
0
File: Display.cs Progetto: rNdm74/C-
        /// <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();
            }
        }
Esempio n. 20
0
File: Display.cs Progetto: rNdm74/C-
 /// <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();
     }
 }