Advertisement
Guest User

Untitled

a guest
Apr 13th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ResponseFetcher.cs:
  2.  
  3.         public Task<T> GetApiResponseAsync(string url)
  4.         {
  5.             using (var client = new HttpClient()) {
  6.  
  7.                 var response = await client.GetAsync(url).ConfigureAwait(false);
  8.                 var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
  9.  
  10.                 return JsonConvert.DeserializeObject<T>(content);
  11.             }
  12.         }
  13.  
  14. ---------------------
  15. LoginViewModel.cs:
  16.  
  17. // Passing the task to RunTask():
  18.  
  19.         ResponseFetcher<Task> task = new ResponseFetcher<Task>("http://10.0.0.141:5000/");
  20.  
  21.         await task.GetApiResponseAsync("api/accounts/verify?username=test&password=test");
  22.  
  23. Error: Start may not be called on a promise-style task.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement