ActivEarth.Objects.Profile.DisplayWeatherControl.GetCurrentConditions C# (CSharp) Метод

GetCurrentConditions() публичный Метод

Get weather information base on location
public GetCurrentConditions ( string location ) : bool
location string The location
Результат bool
        public bool GetCurrentConditions(string location)
        {
            XmlDocument xmlConditions = new XmlDocument();
            xmlConditions.Load(string.Format("http://www.google.com/ig/api?weather={0}", location));

            if (xmlConditions == null || xmlConditions.SelectSingleNode("xml_api_reply/weather/problem_cause") != null)
            {
                return false;
            }

            else
            {
                try
                {
                    Condition.Text = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/condition").Attributes["data"].InnerText;
                    TempF.Text = string.Format("{0}°F", xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_f").Attributes["data"].InnerText);
                    Humidity.Text = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/humidity").Attributes["data"].InnerText;
                    Wind.Text = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/wind_condition").Attributes["data"].InnerText;
                    ConditionImage.ImageUrl = "http://www.google.com" + xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/icon").Attributes["data"].InnerText;
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }