Windows Phone 7 Tips (4)

Source: Internet
Author: User


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





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.