Пример #1
0
        private static void ParseXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            parameters.Add(Temperature.FromDouble(
                               xForecast.Element("temp").Element("metric").Value));

            parameters.Add(new Cloudiness(
                               xForecast.Element("sky").Value));

            parameters.Add(WindSpeed.FromKmph(
                               xForecast.Element("wspd").Element("metric").Value));

            parameters.Add(new WindDirection(
                               xForecast.Element("wdir").Element("degrees").Value));

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

            parameters.Add(Pressure.FromHpa(
                               xForecast.Element("mslp").Element("metric").Value));

            var precip = xForecast.Element("qpf").Element("metric").Value;

            if (precip != "")
            {
                parameters.Add(new PrecipitationAmount(
                                   precip));
            }
            else
            {
                parameters.Add(new PrecipitationAmount(
                                   0));
            }
        }
Пример #2
0
        private static void ParseXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            parameters.Add(new Temperature(
                               xForecast.Element("tempMaxC").Value));
            parameters.Add(new Temperature(
                               xForecast.Element("tempMinC").Value));

            parameters.Add(WindSpeed.FromKmph(
                               xForecast.Element("windspeedKmph").Value));

            parameters.Add(new WindDirection(
                               xForecast.Element("winddirDegree").Value));

            parameters.Add(new PrecipitationAmount(
                               xForecast.Element("precipMM").Value));
        }