Beispiel #1
0
        public static WeatherCondition FromJson(JObject _jObject)
        {
            var condition = new WeatherCondition();

            condition.Code        = (string)_jObject["code"];
            condition.Date        = (string)_jObject["date"];
            condition.Temperature = (string)_jObject["temp"];
            condition.Text        = (string)_jObject["text"];
            return(condition);
        }
Beispiel #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);
        }