private Weather ProcessService(string url) { Weather weather = null; XmlDocument doc = new XmlDocument (); // Load data doc.Load (url); // Set up namespace manager for XPath XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable); ns.AddNamespace ("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0"); // Get current forecast with XPath XmlNode condNode = doc.SelectSingleNode ("/rss/channel/item/yweather:condition", ns); XmlNode astrNode = doc.SelectSingleNode ("/rss/channel/yweather:atmosphere", ns); weather = new Weather { Condition = condNode.Attributes["text"].Value, Temperature = condNode.Attributes ["temp"].Value, Wind = getWindDescription(doc, ns), Humidity = astrNode.Attributes["humidity"].Value }; return weather; }
partial void Refresh(NSObject sender) { CurrentWeather = null; lblTemp.Text = ""; lblCondition.Text = ""; lblWind.Text = ""; lblCityState.Text = ""; iPhoneLocationManager.StartUpdatingLocation(); iPhoneLocationManager.StartUpdatingHeading(); }