Fixed exception while the Sample Browser is shutting down.

This commit is contained in:
the_fiddler 2009-05-30 17:51:19 +00:00
parent 2fd79b720e
commit 7244b80332

View file

@ -19,20 +19,25 @@ namespace Examples
public override void Write(string message) public override void Write(string message)
{ {
_target.Invoke(_invokeWrite, new object[] { message }); if (_target.Created)
_target.Invoke(_invokeWrite, new object[] { message });
} }
public override void WriteLine(string message) public override void WriteLine(string message)
{ {
_target.Invoke(_invokeWrite, new object[] { message + Environment.NewLine }); if (_target.Created)
_target.Invoke(_invokeWrite, new object[] { message + Environment.NewLine });
} }
private delegate void StringSendDelegate(string message); private delegate void StringSendDelegate(string message);
private void SendString(string message) private void SendString(string message)
{ {
// No need to lock text box as this function will only if (_target.Created)
// ever be executed from the UI thread {
_target.Text += message; // No need to lock text box as this function will only
// ever be executed from the UI thread
_target.Text += message;
}
} }
} }
} }