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

            units.Distance    = (string)_jObject["distance"];
            units.Pressure    = (string)_jObject["pressure"];
            units.Speed       = (string)_jObject["speed"];
            units.Temperature = (string)_jObject["temperature"];
            return(units);
        }
コード例 #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);
        }