开发者

How can I store data when was deactivated event fired

When user click the Bing Search or Start button, this will cause Deactivated event.

So, when user press Bing Search or Start Button, How do I store the data. What type of Data can be stored and What to use to 开发者_JS百科store?


You can save:

  • Page state (textbox values, scroll positions) by overriding OnNavigatedFrom and writing values to the Page's State property. You can reload the data in OnNavigatedTo
  • Application state (stuff that applies to all pages that you'd keep if the user hit back to return to the application, but not if they re-launched the application from Start) by handling the Activated / Deactivated events of PhoneApplicationPage and storing data in its State property. If targetting Mango, you can (and should) skip loading your application state if ActivatedEventArgs.IsApplicationInstancePreserved is true.
  • Permanent state (data caches, encrypted user sessions keys) to the file system using IsolatedStorageFile. It's better to do this when you receive that data, rather than waiting for the Deactivated event as taking too long to write data can result in your application being terminated (and corrupting your isolated storage files)

Page/application state dictionaries can store simple types as well as dictionaries and any serialiazable class (which has an empty constructor requirement).


You need to "tombstone" your data. First of all, read about the Execution Model for Windows Phone

After that, read one of the many guides on the subject.


You can use IsolatedStorage or the Application State environment to store information. Sorry to say, but start googling.. you would probably found this if you did.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜