This article briefly introduces the concepts and differences between launchers and choosers, briefly describes the functions of each launcher and chooser, and analyzes their behavior.
Launchers and choosers are designed to uniformly call the services (programs) provided by the system, so that each third-party application can call the same system functions to maintain interface consistency.
Launchers
Starter: Start the Windows Phone 7 built-in application.
Includes the following:
Emailcomposetask: Start the email sending application.
Mediaplayerlauncher: Start the meidaplayer application.
Phonecalltask: Start the call application.
Searchtask: Start the search application.
Smscomposetask: Start the text messaging application.
Webbrowsertask: Start IE.
Marketplacedetailtask: Start the marketplace client application and display the details of the specified application.
Marketplacehubtask: Start the marketplace client application.
Marketplacereviewtask: Start the review page of the marketplace client application.
Marketplacesearchtask: Start the search page of the marketplace client application.
Choosers
Selector: Call the Windows Phone 7 Application to select the required information (such as photos and phone numbers)
Cameracapturetask: Start the photo page and return the photo image after taking the photo.
Emailaddresschoosertask: Start the email address selection interface and return the email address.
Phonenumberchoosertask: Start the phone number selection interface and return the phone number.
Photochoosertask: Start the Image Selection interface and return the image information.
Saveemailaddresstask: Start the email address saving interface. After selecting the email address, the system returns whether the email address is successfully saved.
Savephonenumbertask: Start the save phone number page. After selecting the phone number, the system returns whether the phone number is successfully saved.
What is the difference between a starter and a selector?
The initiator is only responsible for starting the corresponding application.
The selector needs to start the corresponding application interface and wait for the result returned after the operation ends.
Launcher Behavior Analysis
Normally, after the laucher is started, the app. XAML. the application_deactivated method in CS is executed, and the application enters the deactivating state. When the launcher operation ends, the application_activated method is executed, returned to the application, and enters the activating State. However, phonecalltask and mediaplayerlauncher are somewhat special.
The following table lists the statistics:
|
Application_deactivated |
Application_activated |
Constructor on the page |
Emailcomposetask |
Run |
Run |
Run |
Mediaplayerlauncher |
Run |
Run |
Do not execute |
Phonecalltask |
Do not execute |
Do not execute |
Do not execute |
Searchtask |
Run |
Run |
Run |
Smscomposetask |
Run |
Run |
Run |
Webbrowsertask |
Run |
Run |
Run |
Marketplacedetailtask |
Run |
Run |
Run |
Marketplacehubtask |
Run |
Run |
Run |
Marketplacereviewtask |
Run |
Run |
Run |
Marketplacesearchtask |
Run |
Run |
Run |
Phonecalltask pop-up can be regarded as a MessageBox. It only overwrites the program and does not switch the application to the background, so it is not executed.
After the mediaplayerlauncher is started, press the return key to return to the page where the application is located. The constructor of the page is not executed, but all other launders are executed. I don't want to understand it. Please leave a message. Thank you!
Chooser Behavior Analysis
Generally, after chooser is started,
|
Application_deactivated |
Application_activated |
Constructor on the page |
Cameracapturetask |
Run |
Run |
Do not execute |
Emailaddresschoosertask |
Run |
Run |
Do not execute |
Phonenumberchoosertask |
Run |
Run |
Do not execute |
Photochoosertask |
Run |
Run |
Do not execute |
Saveemailaddresstask |
Run |
Run |
Run |
Savephonenumbertask |
Run |
Run |
Run |
From the table above, we can see that the actions of the last two saveemailaddresstask and savephonenumbertask are different from those of the previous four. After the first four chooser are executed, they are automatically returned to the page on which the application calls them, the two chooser will not be automatically returned after execution, but you need to press the return key to return to the page that previously called it.
Therefore, if you do not create a new event and bind the cempleted event in the constructor, then a chooser cannot work normally.
We recommend that you bind the chooser creation (new) and completed events to the constructor instead of other locations.
Code download
References:
The http://msdn.microsoft.com/en-us/library/ff769556 (vs.92). aspx
Windows Phone 7 Training Kit for developers -- lab_launchersandchooserswp7lab