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)
{ {
if (_target.Created)
_target.Invoke(_invokeWrite, new object[] { message }); _target.Invoke(_invokeWrite, new object[] { message });
} }
public override void WriteLine(string message) public override void WriteLine(string message)
{ {
if (_target.Created)
_target.Invoke(_invokeWrite, new object[] { message + Environment.NewLine }); _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)
{
if (_target.Created)
{ {
// No need to lock text box as this function will only // No need to lock text box as this function will only
// ever be executed from the UI thread // ever be executed from the UI thread
_target.Text += message; _target.Text += message;
} }
} }
}
} }