Пример #1
0
        public void UpdateWeather(string city)
        {
            string            url = String.Format("http://api.openweathermap.org/data/2.5/forecast/daily?q={0}&cnt={1}&units=metric&mode=json&APPID={2}", city, CNT, WeatherApiClient.GetAPIKey());
            Task <RootObject> t   = Task.Run(() => WeatherApiClient.GetWeatherForecast(url));

            t.Wait();
            RootObject r = t.Result;

            if (r != null)
            {
                WeatherList = new ObservableCollection <DayElem>(r.list);
                SelectedDay = WeatherList[0];
                Root        = r;
            }
        }