DroidExplorer.Core.UI.CConsole.ConsoleControl.processInterace_OnProcessExit C# (CSharp) Method

processInterace_OnProcessExit() private method

Handles the OnProcessExit event of the processInterace control.
private processInterace_OnProcessExit ( object sender, ProcessEventArgs args ) : void
sender object The source of the event.
args DroidExplorer.Core.UI.CConsole.Api.ProcessEventArgs The instance containing the event data.
return void
        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.
            }
        }