コード例 #1
0
        public static WeatherLocation FromJson(JObject _jObject)
        {
            var weatherLocation = new WeatherLocation();

            weatherLocation.City    = (string)_jObject["city"];
            weatherLocation.Country = (string)_jObject["country"];
            weatherLocation.Region  = (string)_jObject["region"];
            return(weatherLocation);
        }
コード例 #2
0
        public static WeatherItem FromJson(JObject _jObject)
        {
            var wI = new WeatherItem
            {
                Astronomy        = AstronomyInfo.FromJson(_jObject["astronomy"] as JObject),
                Atmosphere       = AtmosphereConditions.FromJson(_jObject["atmosphere"] as JObject),
                CurrentCondition = WeatherCondition.FromJson(_jObject["item"]["condition"] as JObject),
                WLocation        = WeatherLocation.FromJson(_jObject["location"] as JObject),
                Units            = MeasurementUnits.FromJson(_jObject["units"] as JObject),
                Wind             = WindConditions.FromJson(_jObject["wind"] as JObject),
                Location         = GeoLocation.FromJson(_jObject["item"] as JObject),
                Link             = (string)_jObject["item"]["link"],
                Published        = (string)_jObject["item"]["pubDate"],
                Title            = (string)_jObject["item"]["title"],
                Description      = (string)_jObject["item"]["description"]
            };

            foreach (var forecast in _jObject["item"]["forecast"])
            {
                wI.Forecasts.Add(WeatherForecast.FromJson(forecast as JObject));
            }

            return(wI);
        }