private SearchTextResultListItem MapWeatherSearch(WeatherSearchResult wsr) { return new SearchTextResultListItem { Text = wsr.Text }; }
private IEnumerable<WeatherSearchResult> ParseResult(string webResult) { var result = new List<WeatherSearchResult>(); try { var jWeather = JObject.Parse(webResult); var places = jWeather["list"]; foreach (var p in places) { if (!string.IsNullOrWhiteSpace(p["name"].Value<string>())) { var wsr = new WeatherSearchResult(); var country = p["sys"] != null && p["sys"]["country"] != null ? p["sys"]["country"].Value<string>() : string.Empty; wsr.Text = string.Format("{0}{1}: {2}°C", p["name"].Value<string>(), string.IsNullOrEmpty(country) ? string.Empty : string.Format(" ({0})", country), Math.Round(p["main"]["temp"].Value<decimal>(), 1)); result.Add(wsr); } } } catch { } return result; }