예제 #1
0
 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);
         }
     });
 }
예제 #2
0
 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);
         }
     });
 }
예제 #3
0
 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);
         }
     };
 }
예제 #4
0
 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);
         }
     };
 }