Пример #1
0
        void mapControl1_SelectionChanged(object sender, MapSelectionChangedEventArgs e)
        {
            IList <object> selection = e.Selection;

            if (selection == null || selection.Count != 1)
            {
                return;
            }
            CityWeather cityWeatherInfo = selection[0] as CityWeather;

            this.actualWeatherInfo = cityWeatherInfo;
            if (cityWeatherInfo != null)
            {
                if (cityWeatherInfo.Forecast == null)
                {
                    OpenWeatherMapService.GetForecastForCityAsync(cityWeatherInfo);
                    cityWeatherInfo.ForecastUpdated += cityWeatherInfo_ForecastUpdated;
                }
                else
                {
                    cityWeatherInfo_ForecastUpdated(cityWeatherInfo, null);
                }
            }
        }