Exemplo n.º 1
0
 public async void LoadJson(object obj)
 {
     string query = (string)obj;
     try
     {
         using (HttpClient client = new HttpClient())
         using (HttpResponseMessage response = await client.GetAsync(query))
         {
             JsonString = await response.Content.ReadAsStringAsync();
             JsonString = JsonString.Replace("\\u0026quot;", "");
             JsonString = JsonString.Replace("\\u0026nbsp;", "");
             IEnumerable<NewsItem> temp = NewsParser.ParseToList(JsonString);
             Db.AddNews(temp);
         }
     }
     catch (Exception e)
     {
         Trace.TraceInformation(e.Message);
     }
 }