当前位置: 首页>>代码示例>>C#>>正文


C# Frame.GetNavigationState方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.Frame.GetNavigationState方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.GetNavigationState方法的具体用法?C# Frame.GetNavigationState怎么用?C# Frame.GetNavigationState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.Frame的用法示例。


在下文中一共展示了Frame.GetNavigationState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveFrameNavigationState

 private static void SaveFrameNavigationState(Frame frame)
 {
   var frameState = SessionStateForFrame(frame);
   frameState["Navigation"] = frame.GetNavigationState();
 }
开发者ID:imifos,项目名称:Termserver,代码行数:5,代码来源:SuspensionManager.cs

示例2: SaveFrameNavigationState

 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;
 }
开发者ID:ryanhorath,项目名称:Rybird.Framework,代码行数:7,代码来源:SessionStateService.cs

示例3: SaveFrameNavigationState

        private static void SaveFrameNavigationState(Frame frame)
        {
            var frameState = SessionStateForFrame(frame);
			// TODO: exception이 발생한다.
	        try
	        {
            frameState["Navigation"] = frame.GetNavigationState();

	        }
	        catch (Exception)
	        {
		        // do nothing.
	        }
        }
开发者ID:vapps,项目名称:Modern_LiveBoard,代码行数:14,代码来源:SuspensionManager.cs

示例4: SaveFrameNavigationState

 private static void SaveFrameNavigationState(Frame frame) {
   Dictionary<string, object> frameState = SessionStateForFrame(frame);
   frameState["Navigation"] = frame.GetNavigationState();
 }
开发者ID:azrawasia,项目名称:appboy-windows-samples,代码行数:4,代码来源:SuspensionManager.cs

示例5: Navigate

		/// <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();
		}
开发者ID:sdao,项目名称:TuneOut,代码行数:68,代码来源:App.xaml.cs


注:本文中的Windows.UI.Xaml.Controls.Frame.GetNavigationState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。