navigation - NavigationHelper_SaveState vs OnNavigatedFrom -
Basic Page template for Windows Phone 8.1 has the following methods:
private void NavigationHelper_LoadState ( object sender, LoadStateEventArgs e) private void NavigationHelper_SaveState (object sender, SaveStateEventArgs e) my understanding is that NavigationHelper above methods to save page data in NavigationHelper_SaveState NavigationHelper_LoadState is used is available. Of and the OnNavigatedFrom use is made of any of the final second, and OnNavigatedTo to use any preparatory work But also, the data contained in the previous frame in the OnNavigatedFrom method contains the Frame.Navigate () method. My question is, am I right in thinking that the first 2 methods are used to maintain the data in a single page, and the other 2 methods for transferring data between 2 pages Is used?
Post-text "itemprop =" text "> I try to explain how it works and where it is useful.
First of all, by you above all methods have been combined with each other, and more - it Suspension Manager includes see methods (eventhandlers): NavigationHelper_LoadState sound a single NavigationHelper_SaveState Running page navigation events . Are to subscribe: this.navigationHelper.LoadState + = this.NavigationHelper_LoadState; This.navigationHelper.SaveState + = this.NavigationHelper_SaveState; and they `UAE is removed by calling the * NavigationHelper's method: protected override void OnNavigatedTo (NavigationEventArgs e) {This.navigationHelper.OnNavigatedTo (e) ;} // method has been removed inside the event: if (this.LoadState! = Null) {this.LoadState (New LoadStateEventArgs (E. Porter, blank)); } LoadState and SaveState are helpful, which should make it easy to recover your page Whn is this useful? - When your page's resources are being released and after some time you want to take it back simple example: You use FilePicker, ShareTarget, your app has been suspended and its resources have been released, Then when you activate your app (which should be brought back to your page), then you may need to recover the resources of a page (for example, you have to navigate During passing through the parameters) Also keep in mind that those cases also include SuspensionManager and you (pay attention to restoring your app in App.xaml.cs OnLaunched , Active and others). Also note that these templates are only helpful and you may need a different behavior, which you can definitely implement yourself.
Some resources on MSDN:, and.
Comments
Post a Comment