protected override void Dispose(bool finalize) { if (_result != null) { try { _result.EndInvoke(); } catch (ChoFatalApplicationException) { throw; } catch (Exception ex) { ErrorOccured.Raise(this, new ChoExceptionEventArgs(ex)); } finally { _result = null; IChoAsyncResult result = ChoConsole.OutputQueuedExecutionService.Enqueue(() => { //Reset to old settings Console.ForegroundColor = ChoConsole.DefaultConsoleForegroundColor; Console.BackgroundColor = ChoConsole.DefaultConsoleBackgroundColor; Console.SetCursorPosition(0, _statusMsgLocation.Y + 1); Console.WriteLine(); }); result.AsyncWaitHandle.WaitOne(); } } }
public object Run(object value, object contextInfo = null) { RunAsync(value, contextInfo, null); try { IChoAbortableAsyncResult result = _result; if (result != null) { return(result.EndInvoke()); } } finally { OnPlugInRunComplete(_result); _result = null; } return(null); }