public void AsyncConnect() { bool success = false; _asyncThread = Thread.CurrentThread; try { ITerminalConnection result = Connect(); if (!_interrupted) { success = true; Debug.Assert(result != null); ProtocolUtil.FireConnectionSucceeded(_param); _client.SuccessfullyExit(result); } } catch (Exception ex) { if (!(ex is LocalShellUtilException)) { RuntimeUtil.ReportException(ex); } if (!_interrupted) { _client.ConnectionFailed(ex.Message); ProtocolUtil.FireConnectionFailure(_param, ex.Message); } } finally { if (!success && _process != null && !_process.HasExited) { _process.Kill(); } } }
private void NotifyAsyncClient() { if (_succeeded) { _client.SuccessfullyExit(this.Result); } else { _client.ConnectionFailed(_errorMessage); } }