Windows Phone 7 Tips (3)

Source: Internet
Author: User
Tags constructor


1. Windows Phone 7 is a multitasking operating system, but allows only one third-party application to run in the foreground



2. Initiators and selectors provide an indirect way for applications to access the built-in functionality of the phone.



Some built-in initiators: Emailcomposetask, Marketplacedetailtask, Marketplacehubtask, Marketplacereviewtask, MarketplaceSearchTask , Mediaplayerlauncher, Phonecalltask, Searchtask, Smscomposetask, Webbrowsertask.



Some of the built-in selectors: Cameracapturetask, Emailaddresschoosertask, Phonenumberchoosertask, Photochoosertask, Saveemailaddresstask, Savephonenumbertask.



3. When the initiator or selector is started, the application enters the Deactivate state (note that it is not necessarily Tombstone) when the task is only written, the original application is reactivated and the application invokes the activated event. Page Triggers Onnavigationto event



4. If the application in Windows Phone 7 is tombstone, a new instance will be generated when the application is opened again, which calls the app and the constructor of the page, so our logical code is not placed in the constructor, but in the Application_ Code that writes the recovery status in activated, Onnavigationto events.



5. Determine if the network in Windows Phone 7 is available



if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable ()) {// Code when the network is available} else {// The network is not available, give a hint}



Navigation classes in 6.Windows Phone 7: Phoneapplicationframe and PhoneApplicationPage. The alias navigation in Windows Phone 7 supports the following



<nav:UriMapper x:Key="nav">
<nav:UriMapping Uri="Home" MappedUri="/Pages/Views/Default.xaml"/>
<nav:UriMapping Uri="About-Us" MappedUri="/Pages/Views/Misc/About.xaml"/>
<nav:UriMapping Uri="Page/{number}" MappedUri="/Pages/Views/Books/Page{number}.xaml"/>
<nav:UriMapping Uri="Customers/{id}" MappedUri="/Pages/Views/Data/Page.xaml?action=getCustomer&amp;id={id} "/>
<nav:UriMapping Uri="Products/{id}" MappedUri="/Pages/Views/Data/Page.xaml?action=getProduct&amp;id={id} "/>
<nav:UriMapping Uri="Orders/{type}&amp;{id}&amp;{date}" MappedUri="/Pages/Views/Data/Page.xaml?action={type}&amp;orderId={id} &amp;orderDate={number}"/>
</nav:UriMapper>



7.wmappmanifest.xml: A metadata file containing application-specific data, including title, icon location, function, and so on.



8. Page Navigation Scheme



(1) Write the XAML file address directly in the XAML code, such as



<HyperlinkButton Content="Pasta" NavigateUri="/Pasta.xaml" Height="30" HorizontalAlignment="Left"
Margin="10,10,0,0" Name="hyperlinkButton1" VerticalAlignment="Top" Width="200" />



(2) using aliases for navigation in XAML code, you need to configure in App.xaml
(3) Using event handling, such as Navigationservice.navigate (New Uri ("/pasta.xaml", urikind.relative));





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.