Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb service with WP7
    primarykey
    data
    text
    <p>I did appreciate your help for my previous question , and i was wondering how to read data from an URI,using web service(let's assume it's the same data). Here's the url link: <a href="http://www.google.com/ig/api?weather=paris" rel="nofollow">http://www.google.com/ig/api?weather=paris</a> I tryied with this code but it didn't work:</p> <pre><code> public MainPage() { InitializeComponent(); WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(download_string_complete); wc.DownloadStringAsync(new Uri("http://www.google.com/ig/api?weather=hammamet", UriKind.Absolute)); } public void download_string_complete(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { ListBoxItem areaItem = null; StringReader stream = new StringReader(e.Result); XmlReader reader = XmlReader.Create(stream); string day = String.Empty; string low = String.Empty; string high = String.Empty; string condition = String.Empty; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name=="forecast_conditions") { WeatherElement welement = new WeatherElement(); switch (reader.Name) { case ("day_of_week"): { day = reader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = day; friendsBox.Items.Add(day); } break; case ("low"): { low = reader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = low; friendsBox.Items.Add(low); } break; case ("high"): { high = reader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = high; friendsBox.Items.Add(high); } break; case ("condition"): { condition = reader.ReadElementContentAsString(); areaItem = new ListBoxItem(); areaItem.Content = condition; friendsBox.Items.Add(condition); } break; } } } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload