示例#1
0
 public void addLog2(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.txtLog2.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(addLog);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         if (txtLog2.Text.Length > 8000)
         {
             txtLog2.Text = "";
         }
         txtLog2.Text           += text + "\r\n";
         txtLog2.SelectionLength = 0;
         if (txtLog.Text.Length > 0)
         {
             txtLog2.SelectionStart = txtLog.Text.Length - 1;
         }
         txtLog2.ScrollToCaret();
     }
 }
示例#2
0
 private void SetText2(string text)
 {
     if (this.listBox1.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(SetText2);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         this.listBox1.Items.Add(text);
     }
 }
示例#3
0
 private void SetHumText(string text)
 {
     if (this.label3.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(SetHumText);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         this.label3.Text = text;
     }
 }
示例#4
0
 private void DelItem(string text, ListBox lb)
 {
     if (lb.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(DelItem);
         this.Invoke(d, new object[] { text, lb });
     }
     else
     {
         lb.Items.Clear();
     }
 }
示例#5
0
 private void SetText2(string text)
 {
     if (this.lblSalida.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(SetText2);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         //cargarControles();
         this.lblSalida.Text = text;
     }
 }
示例#6
0
        private void SetText2(string text)
        {

            if (this.orderid.InvokeRequired)
            {
                SetTextCallback2 d = new SetTextCallback2(SetText2);
                this.Invoke(d, new object[] { text });
            }
            else
            {
                this.orderid.Text = text;
            }
示例#7
0
 private void SetOpenClass()
 {
     if (this.label2.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(SetOpenClass);
         this.Invoke(d, new object[] { });
     }
     else
     {
         l.Add("Checked, the class is OPEN");
         classOpenTimes.Text = (Convert.ToInt32(classOpenTimes.Text) + 1).ToString();
     }
 }
示例#8
0
 private void Metin_Girisi2(string metin, RichTextBox metin_kutusu)
 {
     // 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 (metin_kutusu.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(Metin_Girisi2);
         this.Invoke(d, new object[] { metin, metin_kutusu });
     }
     else
     {
         metin_kutusu.Text = metin_kutusu.Text + "\n" + metin;
     }
 }
示例#9
0
 public static void SetText2 <TObject>(TObject objCtrl, string text, Form winf) where TObject : ToolStripStatusLabel
 {
     if (objCtrl.Owner.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(SetText2);
         if (winf.IsDisposed)
         {
             return;
         }
         winf.Invoke(d, new object[] { objCtrl, text, winf });
     }
     else
     {
         objCtrl.Text = text;
     }
 }
示例#10
0
 private void ThreadFailed(GThread th, Exception e)
 {
     // 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.rtfDisplay.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(ThreadFailed);
         this.Invoke(d, new object[] { th, e });
     }
     else
     {
         rtfDisplay.AppendText(Environment.NewLine + ":: eduGRID BotManager: " + "Error while Processing. Please rephrase and ask." + Environment.NewLine + "_________________________" + Environment.NewLine);
         rtfDisplay.ScrollToCaret();
     }
 }
示例#11
0
        /// <summary>
        /// metodo auxiliar para actualizar interfaz de usuario.
        /// verifica si fue invocada por otro thread y de ser asi obtiene la firma del thread de de UX y se invoca a si mismo por medio del delegate
        /// actualiza grafica y labels necesarios
        /// </summary>
        /// <param name="text"></param>
        public void SetRamFisica(Double total, Double usada, Double porcentaje)
        {
            if (this.ramFisicaLbl.InvokeRequired)
            {
                SetTextCallback2 d = new SetTextCallback2(SetRamFisica);
                if (!this.IsDisposed)
                {
                    try
                    {
                        this.Invoke(d, new object[] { total, usada, porcentaje });
                    }
                    catch (Exception ex)
                    {
                        //se intento invocar metodo en vista cuando esta ya habia sido recolectada por GC
                        //Console.WriteLine(ex);
                    }
                }
            }
            else
            {
                try
                {
                    if (this.chartRamHistory.Series["RAM F History"].Points.Count >= 30)
                    {
                        this.chartRamHistory.Series["RAM F History"].Points.RemoveAt(0);
                        this.chartRamHistory.Series["RAM F History"].Points.Add(porcentaje);
                    }
                    else
                    {
                        this.chartRamHistory.Series["RAM F History"].Points.Add(porcentaje);
                    }

                    this.chartRamPie.Series["RAM"].Points.Clear();
                    this.chartRamPie.Series["RAM"].Points.Add(total - usada);   //memoria libre
                    this.chartRamPie.Series["RAM"].Points.Add(usada);

                    String s = "Memoria Fisica: " + usada + "/" + total + " MB (" + porcentaje + "%)";
                    this.ramFisicaLbl.Text = s;
                }
                catch (Exception ex)
                {
                    //Console.WriteLine(ex);
                }
            }
        }
示例#12
0
        private void SetText3(string valor)
        {
            // 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.label3.InvokeRequired)
            {
                SetTextCallback2 t = new SetTextCallback2(SetText3);
                try
                { this.Invoke(t, new object[] { valor }); }

                catch (Exception)
                {
                }
            }
            else
            {
                this.label3.Text = valor;
            }
        }
示例#13
0
 private void SetText(string text, CMoneyPrice moneyp)
 {
     if (dgvMonedas.InvokeRequired)
     {
         try
         {
             if (dgvMonedas.IsHandleCreated)
             {
                 SetTextCallback2 d = new SetTextCallback2(SetText);
                 this.Invoke(d, new object[] { text, moneyp });
             }
         }
         catch (StackOverflowException so)
         {
             MessageBox.Show(so.InnerException.ToString());
             txtlogerror.AppendText(so.InnerException.ToString());
         }
         catch (Exception ex)
         {
             //MessageBox.Show(ex.Message);
             txtlogerror.AppendText(ex.Message);
         }
     }
     else
     {
         if (text.Trim().Length > 0)
         {
             if (!text.Trim().Contains("Referencia a objeto no establecida como instancia de un objeto") &&
                 !text.Trim().Contains("Se excedió el tiempo de espera de la operación"))
             {
                 txtlogerror.AppendText(text);
             }
         }
         else
         {
         }
     }
 }
示例#14
0
文件: frmMain.cs 项目: hjgode/VMusage
 public void addLog2(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.txtLog2.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(addLog);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         if (txtLog2.Text.Length > 8000)
             txtLog2.Text = "";
         txtLog2.Text += text + "\r\n";
         txtLog2.SelectionLength = 0;
         if(txtLog.Text.Length>0)
             txtLog2.SelectionStart = txtLog.Text.Length - 1;
         txtLog2.ScrollToCaret();
     }
 }
示例#15
0
 private void ThreadFailed(GThread th, Exception e)
 {
     // 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.rtfDisplay.InvokeRequired)
     {
         SetTextCallback2 d = new SetTextCallback2(ThreadFailed);
         this.Invoke(d, new object[] { th, e });
     }
     else
     {
         rtfDisplay.AppendText(Environment.NewLine + ":: eduGRID BotManager: " + "Error while Processing. Please rephrase and ask." + Environment.NewLine + "_________________________" + Environment.NewLine);
         rtfDisplay.ScrollToCaret();
     }
 }