示例#1
0
        public static WindConditions FromJson(JObject _jObject)
        {
            var windConditions = new WindConditions();

            windConditions.Chill     = (string)_jObject["chill"];
            windConditions.Direction = (string)_jObject["direction"];
            windConditions.Speed     = (string)_jObject["speed"];
            return(windConditions);
        }
示例#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);
        }