GetNavigationState() публичный Метод

public GetNavigationState ( ) : string
Результат string
Пример #1
0
 private static void SaveFrameNavigationState(Frame frame)
 {
   var frameState = SessionStateForFrame(frame);
   frameState["Navigation"] = frame.GetNavigationState();
 }
 private void SaveFrameNavigationState(Frame frame)
 {
     var stateDictionary = new Dictionary<string, object>();
     // It is not at all suspected, but by design frame.GetNavigationState() will call OnNavigatedFrom on the current page
     stateDictionary.Add("NavigationState", frame.GetNavigationState());
     _sessionState["Navigation"] = stateDictionary;
 }
Пример #3
0
        private static void SaveFrameNavigationState(Frame frame)
        {
            var frameState = SessionStateForFrame(frame);
			// TODO: exception이 발생한다.
	        try
	        {
            frameState["Navigation"] = frame.GetNavigationState();

	        }
	        catch (Exception)
	        {
		        // do nothing.
	        }
        }
 private static void SaveFrameNavigationState(Frame frame) {
   Dictionary<string, object> frameState = SessionStateForFrame(frame);
   frameState["Navigation"] = frame.GetNavigationState();
 }
Пример #5
0
		/// <summary>
		/// Attempts to navigate to a specific page, loading from suspension settings if requested.
		/// </summary>
		/// <param name="pageType">The type of the page.</param>
		/// <param name="parameter">The parameter to pass to the page.</param>
		/// <param name="previousState">The previous execution state of the application. If the previous state was ApplicationExecutionState.Terminated, then the method will attempt to load suspension settings. </param>
		/// <param name="forceReplaceCurrent">Determines whether the current page is replaced never, always, or only if it is different.</param>
		/// <param name="clearHistory">Clears the history stack up to this point. Use this option if navigating to a page without a back button.</param>
		/// <returns>A Task object for async operations.</returns>
		public async System.Threading.Tasks.Task Navigate(Type pageType, object parameter, ApplicationExecutionState previousState = ApplicationExecutionState.Running, NavigationReplacementMode forceReplaceCurrent = NavigationReplacementMode.ReplaceIfDifferent, bool clearHistory = true)
		{
			Frame rootFrame = Window.Current.Content as Frame;

			// Do not repeat app initialization when the Window already has content,
			// just ensure that the window is active
			if (rootFrame == null)
			{
				// Create a Frame to act as the navigation context and navigate to the first page
				// This Root Frame contains the media element!
				rootFrame = new Frame();
				rootFrame.Style = Resources["RootFrameStyle"] as Style;

				App.NAVIGATION_EMPTY = rootFrame.GetNavigationState(); // Save the wasEmpty navigation state
				TuneOut.Common.SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

				if (previousState == ApplicationExecutionState.Terminated)
				{
					// Restore the saved session state only when appropriate
					try
					{
						await TuneOut.Common.SuspensionManager.RestoreAsync();
					}
					catch (TuneOut.Common.SuspensionManagerException)
					{
						// Something went wrong restoring state.
						// Assume there is no state and continue
					}
				}

				// Place the frame in the current Window
				Window.Current.Content = rootFrame;
			}

			if (clearHistory && NAVIGATION_EMPTY != null)
			{
				rootFrame.SetNavigationState(NAVIGATION_EMPTY);
			}

			if (forceReplaceCurrent == NavigationReplacementMode.AlwaysReplace && !rootFrame.Navigate(pageType, parameter))
			{
				throw new Exception("Failed to navigate to page");
			}
			else if (forceReplaceCurrent == NavigationReplacementMode.ReplaceIfDifferent && rootFrame.CurrentSourcePageType != pageType && !rootFrame.Navigate(pageType, parameter))
			{
				throw new Exception("Failed to navigate to page");
			}
			else if (rootFrame.Content == null && !rootFrame.Navigate(pageType, parameter))
			{
				// When the navigation stack isn't restored navigate to the first page,
				// configuring the new page by passing required information as a navigation
				// parameter

				throw new Exception("Failed to create initial page");
			}

			// Ensure the current window is active
			Window.Current.Activate();
		}