Exemplo n.º 1
0
        public void updatePanelWeather()
        {
            var city = CityList.SelectedItem as City;

            // получаем прогноз погоды
            if (city == null)
            {
                return;
            }
            WeatherApi.GetCityWithWeather(city);

            panelWeather.Controls.Clear();
            foreach (var weatherForecast in city.WeatherForecasts.Where(t => t.Date.Date == dateTimePicker.Value.Date).Reverse())
            {
                WeatherTab weather = new WeatherTab(
                    weatherForecast.PartOfDay,
                    weatherForecast.Sky,
                    weatherForecast.Temperature,
                    weatherForecast.Pressure,
                    (int)weatherForecast.Speed,
                    weatherForecast.Wind,
                    weatherForecast.Humidity);
                panelWeather.Controls.Add(weather);
            }
        }