Exemplo n.º 1
0
 private void AddStatus(string status)
 {
     if (richTextBoxStatus.InvokeRequired)
     {
         AddStatusCallback callback = AddStatus;
         richTextBoxStatus.Parent.Invoke(callback, new object[] { status });
     }
     else
     {
         richTextBoxStatus.AppendText(status + "\r\n");
     }
 }
        private void AddStatus(string result)
        {
            if (string.IsNullOrEmpty(result))
            {
                return;
            }

            // 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.InvokeRequired)
            {
                AddStatusCallback callback = new AddStatusCallback(AddStatus);
                this.Invoke(callback, new object[] { result });
            }
            else
            {
                listBox_status.Items.Add(result);
                textBoxStatus.AppendLine(result);
            }
        }