private void Log(String text) { MyForm.Invoke(new Action( delegate() { MyRichTextBox.Text += text + Environment.NewLine; MyRichTextBox.SelectionStart = MyRichTextBox.Text.Length; MyRichTextBox.ScrollToCaret(); })); MyForm.Invoke(new Action( delegate() { MyForm.Refresh(); })); }
private void LogException(Exception ex) { MyForm.Invoke(new Action( delegate() { MyRichTextBox.Text += ex.Message + Environment.NewLine; MyRichTextBox.Text += ex.StackTrace + Environment.NewLine; MyRichTextBox.SelectionStart = MyRichTextBox.Text.Length; MyRichTextBox.ScrollToCaret(); })); MyForm.Invoke(new Action( delegate() { MyForm.Refresh(); })); }