void processInterace_OnProcessExit(object sender, ProcessEventArgs args)
{
try {
if(!this.IsHandleCreated)
return;
// Are we showing diagnostics?
if(ShowDiagnostics && !this._isDisposed) {
WriteOutput(Environment.NewLine + processInterace.ProcessFileName + " exited.", Color.FromArgb(255, 0, 255, 0));
}
if(this.InvokeRequired) {
// Read only again.
Invoke((Action)(() => {
richTextBoxConsole.ReadOnly = true;
}));
} else {
richTextBoxConsole.ReadOnly = true;
}
// trigger process exit.
if(this.OnProcessExit != null) {
this.OnProcessExit(this, new ConsoleEventArgs());
}
} catch(Exception ex) {
// if the window has been closed this blows up.
}
}