/// <summary> /// Restore the navigation stack /// </summary> public async Task <bool> LoadAsync() { if (NavigationFrame == null) { throw new InvalidOperationException("Must set root Frame prior to calling PageNavigator.LoadAsync"); } if (StateManager != null) { bool loaded = await StateManager.LoadAsync(); if (loaded) { string frameKey = string.IsNullOrEmpty(_frameKey) ? DefaultFrameKey : _frameKey; var frameDictionary = StateManager.GetDictionary(frameKey, false); if (frameDictionary != null) { if (frameDictionary.ContainsKey(NavigationStackKey)) { NavigationFrame.SetNavigationState((string)frameDictionary[NavigationStackKey]); ProcessRestore(); return(true); } } } } return(false); }
/// <summary> /// Restore the navigation stack /// </summary> public async Task <bool> LoadAsync() { if (NavigationFrame == null) { throw new InvalidOperationException("Must set root Frame prior to calling PageNavigator.LoadAsync"); } if (StateManager != null) { bool loaded = await StateManager.LoadAsync(); if (loaded) { string frameKey = string.IsNullOrEmpty(_frameKey) ? PageNavigator.DefaultFrameKey : _frameKey; var frameDictionary = StateManager.GetDictionary(frameKey, false); if (frameDictionary != null) { if (frameDictionary.ContainsKey(PageNavigator.NavigationStackKey)) { // This will restore the parameter string navData = (string)frameDictionary[PageNavigator.NavigationStackKey]; NavigationFrame.SetNavigationState(navData); int index = navData.LastIndexOf('$'); if (index != -1) { ProcessRestore(navData.Substring(index)); } return(true); } } } } return(false); }