Common use of WebClient code snippets in 1.Windows Phone 7:
WebClient twitter = new WebClient();
twitter.DownloadStringCompleted += new DownloadStringCompletedEventHandler (twitter_DownloadStringCompleted);
twitter.DownloadStringAsync(new Uri ("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + TwitterNameBox.Text));
2. When Windows Phone 7 program is deactivated, we need to process both persisted data and transient data for the program.
A. Save persisted data to Isolatedstroage
B. Process application transient data in App.xaml.cs deactivated events, saving application transient data to Phoneapplicationservice.state
C. Process page transient data in the Onnavigatedfrom event of a page, saving page transient data to Phoneapplicationpage.state
3. For XML data sources acquired through WebClient, we can use LINQ to XML for ease of operation and get properties to bind
XElement xmlTweets = XElement.Parse(e.Result);
TwitterList.ItemsSource = from tweet in xmlTweets.Descendants("status") select new TwitterItem{message = tweet.Element ("text").Value};
4. In using LINQ to XML you need to be aware that the returned XML data contains no namespaces
This is to return the XML data from the part intercepted in the tweet search WP7 project, noting that the return XML data contains namespaces