示例#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(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));
        }
示例#3
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));
        }
示例#4
0
        private static void ConvertHourForecast(HourForecast hourForecast, List <AbstractParameter> parameters)
        {
            parameters.Add(new Temperature(
                               hourForecast.temperature));

            parameters.Add(Pressure.FromHpa(
                               hourForecast.pressure));

            parameters.Add(new PrecipitationAmount(
                               hourForecast.precipIntensity));

            parameters.Add(Humidity.FromPart(
                               hourForecast.humidity));

            parameters.Add(Cloudiness.FromPart(
                               hourForecast.cloudCover));

            parameters.Add(new WindDirection(
                               hourForecast.windBearing));

            parameters.Add(new WindSpeed(
                               hourForecast.windSpeed));
        }