public void Run() { var request = CreateRequest(); if (OnWrite != null) { OnWrite.Invoke(request); } else { OnWriteAsync?.Invoke(request, CancellationToken.None).GetAwaiter().GetResult(); } using (var response = (HttpWebResponse)request.GetResponse()) { if (OnRead != null) { OnRead?.Invoke(response); } else { OnReadAsync?.Invoke(response, CancellationToken.None).GetAwaiter().GetResult(); } } }
public async Task RunAsync() { var request = CreateRequest(); if (OnWriteAsync != null) { await OnWriteAsync.Invoke(request); } else if (OnWrite != null) { OnWrite.Invoke(request); } using (var response = (HttpWebResponse)await request.GetResponseAsync()) { if (OnReadAsync != null) { await OnReadAsync.Invoke(response); } else if (OnRead != null) { OnRead?.Invoke(response); } } }
public override void Write(string message) { OnWrite.Invoke(message); }
public void WriteLine(decimal value) { Console.Print(value, ref this.output); OnWrite?.Invoke(this, new EventArgs()); }
public void WriteLine() { Console.Print(output: ref this.output); OnWrite?.Invoke(this, new EventArgs()); }
public void Write(int value) { Console.Print(value, ref this.output, end: ""); OnWrite?.Invoke(this, new EventArgs()); }
public void Write(string format, params object[] arg) { Console.Print(string.Format(format, args: arg), ref this.output, end: ""); OnWrite?.Invoke(this, new EventArgs()); }
public void Write(string format, object arg0, object arg1, object arg2) { Console.Print(string.Format(format, arg0, arg1, arg2), ref this.output, end: ""); OnWrite?.Invoke(this, new EventArgs()); }