1 / 14

Understanding Application Lifecycle & State Management

Understanding Application Lifecycle & State Management. Danilo Diaz, Developer Evangelist Lindsay Lindstrom, Developer Evangelist http://blogs.msdn.com/lindsay. (Tue 4/3 10AM PST) - http://aka.ms/HackReadyPhone1 Introduction to the Windows Phone Platform

shaina
Télécharger la présentation

Understanding Application Lifecycle & State Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Understanding Application Lifecycle & State Management Danilo Diaz, Developer Evangelist Lindsay Lindstrom, Developer Evangelist http://blogs.msdn.com/lindsay

  2. (Tue 4/3 10AM PST) - http://aka.ms/HackReadyPhone1Introduction to the Windows Phone Platform (Thur 4/5 10AM PST) - http://aka.ms/HackReadyPhone2Working with Internal & External Data in Windows Phone (Tue 4/10 10AM PST) - http://aka.ms/HackReadyPhone3 Understanding Windows Phone’s Application Lifecycle and State Management(Thur 4/12 10AM PST) - http://aka.ms/HackReadyPhone4 Working with Windows Phone Sensors and Other APIs?(Tue 4/17 10AM PST) - http://aka.ms/HackReadyPhone5 Enhancing the User Experience and App Usability with Live Tiles, Push Notifications, and Background Agents(Thur 4/19 10AM PST) - http://aka.ms/HackReadyPhone6Enhancing Performance and Application Testing(Tue 4/24 10AM PST) - http://aka.ms/HackReadyPhone7Everything You Need to Know About Releasing Your Apps

  3. What we are building…

  4. Application Lifecycle - Dormant Fast App Resume State preserved! e.IsApplicationInstancePreserved== true Save State! Phone resources detached Threads & timers suspended

  5. Application Lifecycle - Tombstoned Resuming .. . Restore state! e.IsApplicationInstancePreserved== false activated Tombstoned Tombstone the oldest app Phone resources detached Threads & timers suspended

  6. Methods & Events

  7. Finding the Resume type privatevoidApplication_Activated(object sender, ActivatedEventArgs e) { if (e.IsApplicationInstancePreserved) { // Dormant - objects in memory intact } else { // Tombstoned - need to reload } } • The Activation handler can test a flag to determine the type of resume taking place

  8. Deactivation Resource Management Deactivated App MediaPlayer.Pause MediaElement.Pause SoundEffectInstance.Pause VibrateController.Stop PhotoCamera.Dispose Save page/global state PhoneApplicationPage. OnNavigatedFrom PhoneApplicationService. Deactivated Framework: Detach Resources Framework: Suspend Timers and Threads Dormant App

  9. Activation Resource Management Running App PhoneApplicationPage. OnNavigatedTo MediaElement.Source/Position/Play Socket.ConnectAsync new PhotoCamera/VideoCamera Restore app state if tombstoned PhoneApplicationService. Activated Framework: Attach Resources Framework: Resume Timers and Threads Dormant App

  10. Isolated Storage vs State Storage • Isolated storage is so called because the data for an application is isolated from all other applications • It can be used as filestore where an application can store folders and files • It is slow to access, since it is based on NVRAM technology • It can also be used to store name/value pairs, e.g. program settings • State storage is so called because it is used to hold the state of an application • It can be used to store name/value pairs which are held in memory for dormant or tombstoned applications • It provides very quick access to data

  11. Captain’s Log With No Storage With Storage Fully Working

  12. Fast App Switching & TombstoningReview • Only one Windows Phone application is Active at any time • The Start and Back buttons on the phone are used to start new applications and return to previously used ones • If an application is replaced by another it is either made Dormant (still in memory but not running) or Tombstoned (removed from memory) • Applications must use populate methods provided in the App.xaml.cs class to save and retrieve state information when appropriate • State can be stored in memory for quick reload and in isolated storage which serve as a permanent store

  13. Resources create.msdn.com http://ux.artu.tv/ http://silverlight.codeplex.com http://coding4fun.codeplex.com http://create.msdn.com/en-US/education/catalog/ http://smallandmighty.net/blog/windows-phone-design-resources http://smallandmighty.net/blog/windows-phone-resources

  14. Thank You Danilo Diaz danilod@microsoft.com Smallandmighty.net @DaniDiaz Lindsay Lindstrom lindsayr@microsoft.com blogs.msdn.com/lindsay @LindsayInPhilly

More Related