Exemple #1
0
        public void GetCityWeather(GeoCoordinate location, string postalCode, Action <CityWeatherResult, Exception> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            if (string.IsNullOrEmpty(postalCode))
            {
                postalCode = GetPostalCodeFromGeoCoordinate(location).ToString();
            }

            var result = new CityWeatherResult()
            {
                CityWeatherThreeDaysImage = new Uri(string.Format(
                                                        Resources.FaroeIslands_CityWeatherThreeDaysImage, postalCode)),
                CityWeatherSevenDaysImage = new Uri(string.Format(
                                                        Resources.FaroeIslands_CityWeatherSevenDaysImage, postalCode)),
            };

            callback(result, null);
        }
Exemple #2
0
        public void GetCityWeather(GeoCoordinate location, string postalCode, Action<CityWeatherResult, Exception> callback)
        {
            if (callback == null)
                throw new ArgumentNullException("callback");

            if (string.IsNullOrEmpty(postalCode))
                postalCode = GetPostalCodeFromGeoCoordinate(location).ToString();

            var result = new CityWeatherResult()
            {
                CityWeatherThreeDaysImage = new Uri(string.Format(
                    Resources.Greenland_CityWeatherThreeDaysImage, postalCode)),
                CityWeatherSevenDaysImage = new Uri(string.Format(
                    Resources.Greenland_CityWeatherSevenDaysImage, postalCode)),
                CityWeatherFourteenDaysImage = new Uri(string.Format(
                    Resources.Greenland_CityWeatherFourteenDaysImage, postalCode)),

            };

            callback(result, null);
        }
Exemple #3
0
        private static void GetCityWeatherFromPostalCode(int postalCode, Action<CityWeatherResult, Exception> callback)
        {
            if (callback == null)
                throw new ArgumentNullException("callback");

            var result = new CityWeatherResult()
            {
                CityWeatherThreeDaysImage = new Uri(string.Format(
                    Resources.Denmark_CityWeatherThreeDaysImage, postalCode)),
                CityWeatherSevenDaysImage = new Uri(string.Format(
                    Resources.Denmark_CityWeatherSevenDaysImage, postalCode)),
                CityWeatherFourteenDaysImage = new Uri(string.Format(
                    Resources.Denmark_CityWeatherFourteenDaysImage, postalCode)),
                CityWeatherFifteenDaysImage = new Uri(string.Format(
                Resources.Denmark_CityWeatherFifteenDaysImage, postalCode)),
            };

            callback(result, null);
        }