Note that there are some explanatory texts on larger screens.

plurals
  1. POStuck with web-service on WP7
    primarykey
    data
    text
    <p>yesterday i did ask about how to extract some data from a complicated xml file , using web service, on the Windows Phone 7 , but unfortuntly i did not get an answer, and i'm still stuck. This is the c# code i wrote and did not display the data on my application's screen:</p> <pre><code> public MainPage() { InitializeComponent(); SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape; Uri url = new Uri("http://www.google.com/ig/api?weather=paris", UriKind.Absolute); WebClient client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(url); } void client_DownloadStringCompleted(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 areaName = String.Empty; string low = String.Empty; string high = String.Empty; string condition = String.Empty; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case ("day_of_week"): { if (true == reader.MoveToFirstAttribute()) { reader.MoveToContent(); day = reader.ReadElementContentAsString(); day = reader.Value.ToString(); areaItem = new ListBoxItem(); areaItem.Content = day; listBox1.Items.Add(areaItem); } } break; case ("low"): { if (true == reader.MoveToFirstAttribute()) { reader.MoveToContent(); low = reader.ReadElementContentAsString(); low = reader.Value.ToString(); areaItem = new ListBoxItem(); areaItem.Content = low; listBox1.Items.Add(areaItem); } } break; case ("high"): { if (true == reader.MoveToFirstAttribute()) { reader.MoveToContent(); high = reader.ReadElementContentAsString(); high = reader.Value.ToString(); areaItem = new ListBoxItem(); areaItem.Content = high; listBox1.Items.Add(areaItem); } } break; case ("condition"): { if (true == reader.MoveToFirstAttribute()) { reader.MoveToContent(); condition = reader.ReadElementContentAsString(); condition = reader.Value.ToString(); areaItem = new ListBoxItem(); areaItem.Content = condition; listBox1.Items.Add(areaItem); } } break; } } } } } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    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