using (HttpClient client = new HttpClient()) { pbWeather.Visibility = System.Windows.Visibility.Visible; client.BaseAddress = new Uri("http://192.168.1.19/projects/t20lite/index.php/api/api/get_players?userid=1&deviceuniqueid=123&devicetime=456"); var url = "get_players?userid=1&deviceuniqueid=123&devicetime=456"; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await client.GetAsync(String.Format(url, txtCountryName.Text)); if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync(); var weatherdata = JsonConvert.DeserializeObject<PlayersInfo>(data.Result.ToString()); spWeatherInfo.DataContext = weatherdata; } pbWeather.Visibility = System.Windows.Visibility.Collapsed; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)