Last tips: Windows Phone 7 tips (1) Today, we also share 10 Windows Phone 7 tips and provide offline document downloads.
1. The simplest operation of isolatedstorge in Windows Phone 7Code : Savenote(save the content in the example box to note.txt. edit(← read and retrieve note.txt to the text box.
2. Orientation in Windows Phone 7
It can be divided into portrait (landscape screen), landscape (landscape screen), and portraitorlandscape (landscape screen or landscape screen, automatically switch when switching landscape screen ). The options include support direction and start direction. The options include portrait, landscape, and portraitorlandscape. The options include landscape, landscapeleft, landscaperight, portrait, portraitdown, and portraitup.
3. Comparison of common UI layout controls in Windows Phone 7
Canvas: the absolute positioning control, which is fast and can be used in games.
Grid: Grid Positioning Control, commonly used
Stackpanel: automatically locates controls, which are recommended for use with small areas.
4. Briefly describe the lifecycle of Windows Phone 7 . The following figure will help you
Specific ApplicationProgramAnd when to trigger the following table:
Application Event |
Occurs when |
Your actions |
Application_launching |
The user taps the entry for an application on the installed applications screen, and a new instance of an application is created. |
Do not read application settings from the isolated storage as that will slow down the loading process; do not attempt to restore transient state. When an application launches, it shoshould always appear as a new instance. |
application_activated |
for this event to occur, two conditions must be met: (1) The user navigates away from your application, either by using a launcher or a chooser, or by starting another application and (2) the user then comes back to your application by either completing the launcher or chooser or using the hardware back button. this event is not raised when an application is first launched. |
the application shocould allow the user to continue interaction as if she had never left the application; transient state information shocould be restored, but the application shoshould not attempt to read the contents of the isolated storage to avoid potential slowdown. |
application_deactivated |
the user navigates away from your application either by invoking a launcher or a chooser, or by launching another application. this event is not raised when your application is closing. |
You shoshould save all transient (I. E ., related to the current application session) State into the State dictionary. you shoshould save persistent state to an isolated storage. applications are given ten seconds to complete this event; after ten seconds, if this event is still not completed, an application will be terminated and not tombstoned. |
Application_closing |
The user uses the back key to navigate past the first page of your application. |
Save all of the persistent state into the isolated storage. |
5. Make sure that the first page of your Windows Phone 7 Application is loaded and rendered in 5 seconds, and your application is available in 20 seconds!
6. Differences between the image resource and content in Windows Phone 7: Images generated in resource mode will be compiled into the application assembly (DLL), while images generated in content mode will be deployed in the xap package.
When you copy your image to a project, the image generation action defaults to resource (Resource), But I usually choose content to get faster. How should we select the image generation method (build action? Each generation method has its own application: Setting the generation method to content means that the application can load image resources more quickly. Setting the generation method to resource is very useful for you to redeploy the program, this is suitable for class library projects.
7. Physical rollback key in Windows Phone 7: How to disable the physical rollback key in the phoneapplicationpage_backkeypress event in tips (1), that is, E. Cancel =TrueIf we do not write code, what will Windows Phone 7 do when we click the back key? As far as I know, there are three situations:
(1). When you click back-to-cycle, the program must return to the previous page
(2). If you click the back button on the first page of the program, the application must launch
(3) If your application is in a real dialog box or context menu, When you click the back button, Windows Phone 7 will automatically close the dialog box or context menu.
8. Windows Phone 7 applications have two types of data: persistent data and transient state)
Persistent data: such as configuration files and isolatedstorage)
Transient status: exists in a specific program session, such as page status, Web Request cache, and transient status with the phoneapplicationservice. state attribute.
|
validity range |
storage location |
read/write |
persistent data |
all applications on phone |
isolatedstorage |
when the program is enabled/disabled, or when the program is running |
transient state |
application session |
state attribute of phoneapplicationservice |
invalid program/activation |
9. We 'd better not load data from the isolated bucket in the application_launching and application_activated events of the applicationBecause it slows down the startup of our program.
10. The isolatedstoragesetttings class provides a simple serialization of data. We can use existing serialization methods (such as JSON) to persistently store data in an isolated bucket.
CHM File Download: (41kb)