Beispiel #1
0
 public void addLog(string logLine)
 {
     // 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.logRichTextBox.InvokeRequired)
     {
         addLogCallback d = new addLogCallback(addLog);
         this.Invoke(d, new object[] { logLine });
     }
     else
     {
         this.logRichTextBox.Text += logLine + "\r\n";
     }
 }
Beispiel #2
0
        //================================================================================
        public void addLog(String s)
        {
            if (!isWorking)
            {
                return;
            }

            if (this.txtLog.InvokeRequired)
            {
                addLogCallback d = new addLogCallback(addLog);
                this.Invoke(d, new object[] { s });
            }
            else
            {
                this.txtLog.AppendText(s);
                this.txtLog.SelectionStart = this.txtLog.Text.Length;
                this.txtLog.ScrollToCaret();
            }
        }
        public void addLog(string msg)
        {
            if (tbLog.InvokeRequired)
            {
                addLogCallback d = new addLogCallback(addLog);

                try
                {
                    this.Invoke(d, msg);
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                tbLog.Text += System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString() + "\t" + msg + "\r\n";
                tbLog.SelectionStart = tbLog.Text.Length;
                tbLog.ScrollToCaret();
                tbLog.Refresh();
            }
        }