protected async override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var sb = new StringBuilder(Delim); sb.AppendLine(); try { await DumpAsync(sb, request).ConfigureAwait(false); var sw = Stopwatch.StartNew(); var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); sw.Stop(); await DumpAsync(sb, response, sw).ConfigureAwait(false); return(response); } catch (Exception ex) { Dump(sb, ex); throw; } finally { sb.AppendLine(Delim); CallMade?.Invoke(this, new CallMadeEventArgs(sb.ToString())); } }
public void MakeCall(int receiver) { try { CallMade.Invoke(this, receiver); } catch (ArgumentException ex) { Console.WriteLine("{0}: making call: {1}", this.Number, ex.Message); } }
public void MakeCall(int receiver) { try { var operatorMessage = CallMade.Invoke(this, receiver); HandleOperatorResponse(operatorMessage); } catch (ArgumentException ex) { Console.WriteLine("{0}: making call: {1}", this.Number, ex.Message); } }