public void WriteTextSafe(string text) { try { if (!this.IsDisposed) { if (textBox1.InvokeRequired) { var d = new SafeCallDelegate(WriteTextSafe); Invoke(d, new object[] { text }); } else { textBox1.AppendText(text + Environment.NewLine); } } } catch (Exception e) { Ribbon1.WriteToLogFile("ConsoleForm.WriteTextSafe exception caught: " + e.Message, Ribbon1.logFilePath); } }
public void OverWriteText(string text) { try { if (!this.IsDisposed) { if (textBox1.InvokeRequired) { var d = new SafeCallDelegate(OverWriteText); Invoke(d, new object[] { text }); } else { textBox1.Text = textBox1.Text.Remove(textBox1.Text.LastIndexOf(Environment.NewLine)); textBox1.Text = textBox1.Text.Remove(textBox1.Text.LastIndexOf(Environment.NewLine)); textBox1.AppendText(Environment.NewLine + text + Environment.NewLine); } } } catch (Exception e) { Ribbon1.WriteToLogFile("ConsoleForm.OverWriteText exception caught: " + e.Message, Ribbon1.logFilePath); } }