private Action<Task<string>> ResponseRead(ClientOperationState state) { return task => { try { state.Response.Body = task.Result; state.Dispose(); state.OnSuccess(state.Response); } catch (Exception ex) { state.Dispose(); state.OnError(ex); } }; }
private Action<Task<HttpResponseMessage>> RequestSent(ClientOperationState state) { return task => { try { var responseMsg = task.Result; state.Response = new HttpResponse(responseMsg); responseMsg.Content.ReadAsStringAsync() .ContinueWith(ResponseRead(state)); } catch (Exception ex) { state.Dispose(); state.OnError(ex); } }; }
private Action<Task<string>> ResponseRead(ClientOperationState state) { return task => { try { state.Response.Body = task.Result; state.Dispose(); state.OnSuccess(state.Response); } catch(Exception ex) { state.Dispose(); state.OnError(ex); } }; }