private void UpdateWeatherForecast() { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new ForecastMethodInvoker(UpdateWeatherForecast)); return; } JObject Forecast = OpenWeatherMap.OpenWeatherMap.FiveDayForecast(CityID, OpenWeatherMapAppID); JArray Points = new JArray(((JArray)Forecast.GetValue("list")).OrderBy(p => (long)p["dt"])); List <string> labels = new List <string>(); ChartValues <double> values = new ChartValues <double>(); for (int i = 0; i < 8; i++) { JObject point = (JObject)Points[i]; values.Add((int)Convert.ToDouble(point["main"]["temp"].ToString())); labels.Add(UnixTimeStampToDateTime(Convert.ToInt64(point["dt"].ToString())).ToString("HH:mm")); } SeriesCollection[0].Values = values; Labels = labels.ToArray(); WeatherForecast.Update(); }