Esempio n. 1
0
        /// <summary>
        /// Returns an XmlDocument with current condition weather data for the
        /// specified location using the specified unit type. If the provider
        /// cannot provide current conditions this method will return null.
        /// </summary>
        /// <param name="locationID">A valid location ID string</param>
        /// <param name="units">Imperial or Metric units</param>
        /// <returns>XmlDocument or null</returns>
        public XmlDocument GetCurrentConditions(string locationID, XoapWeather.Provider.WeatherUnits units)
        {
            XoapRequest request = new XoapRequest();

            request.CurrentConditionReport = true;
            request.Units = units;
            string url = String.Format(CultureInfo.InvariantCulture, XOAP_WX_URL, locationID, request.QueryString);
            return GetDataFromServer(locationID, url);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns an XmlDocument with forecast weather data for the
        /// specified location using the specified unit type for the specified
        /// number of days. If the provider cannot provide a forecast this method
        /// will return null.
        /// </summary>
        /// <param name="locationID">A valid location ID string</param>
        /// <param name="units">Imperial or Metric units</param>
        /// <param name="days">Number of days (0 means today)</param>
        /// <returns>XmlDocument or null</returns>
        public XmlDocument GetForecast(string locationID, XoapWeather.Provider.WeatherUnits units, int days)
        {
            XoapRequest request = new XoapRequest();

            request.DailyForecast = days;
            request.DetailDailyForecast = days;
            request.RegionalConditionReport = true;
            request.Units = units;
            request.HourByHourForecast = 12;
            string url = String.Format(CultureInfo.InvariantCulture, XOAP_WX_URL, locationID, request.QueryString);
            return GetDataFromServer(locationID, url);
        }