示例#1
0
        private static void ParseXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            parameters.Add(Temperature.FromDouble(
                               xForecast.Element("temperature").Attribute("value").Value));

            parameters.Add(Pressure.FromHpa(
                               xForecast.Element("pressure").Attribute("value").Value));

            var xPrecipVal = xForecast.Element("precipitation").Attribute("value");

            if (xPrecipVal != null)
            {
                parameters.Add(new PrecipitationAmount(
                                   xPrecipVal.Value));
            }
            else
            {
                parameters.Add(new PrecipitationAmount(0));
            }

            parameters.Add(new Humidity(
                               xForecast.Element("humidity").Attribute("value").Value));

            parameters.Add(new Cloudiness(
                               xForecast.Element("clouds").Attribute("all").Value));

            parameters.Add(WindDirection.FromDouble(
                               xForecast.Element("windDirection").Attribute("deg").Value));

            parameters.Add(WindSpeed.FromDouble(
                               xForecast.Element("windSpeed").Attribute("mps").Value));
        }
示例#2
0
        private static void ParseMainXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            parameters.Add(Temperature.FromDouble(
                               xForecast.Element("temperature").Attribute("value").Value));

            parameters.Add(WindDirection.FromDouble(
                               xForecast.Element("windDirection").Attribute("deg").Value));

            parameters.Add(WindSpeed.FromDouble(
                               xForecast.Element("windSpeed").Attribute("mps").Value));

            parameters.Add(Humidity.FromDouble(
                               xForecast.Element("humidity").Attribute("value").Value));

            parameters.Add(Pressure.FromHpa(
                               xForecast.Element("pressure").Attribute("value").Value));

            parameters.Add(Cloudiness.FromDouble(
                               xForecast.Element("cloudiness").Attribute("percent").Value));
        }