假设我以这种方式设计了页面导航:
P(1) -> goto P(2) -> goto P(3) 并在 P(3) 处,用户单击 Home 按钮(Microsoft 按钮)
a) 应用程序重新启动时如何返回 p(3)?
谢谢
- - 更新
我需要在这个活动上做什么?
受保护的覆盖无效 OnLaunched(LaunchActivatedEventArgs args)
{
Frame rootFrame = Window.Current.Content as Frame;
// 当 Window 已经有内容时,不要重复应用初始化,
// 只需确保窗口处于活动状态
if (rootFrame == null)
{
// 创建一个 Frame 作为导航上下文并导航到第一页
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO:从先前挂起的应用程序加载状态
}
// 将框架放置在当前窗口中
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// 当导航堆栈未恢复时,导航到第一页,
// 通过传递所需信息作为导航来配置新页面
// 范围
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("创建初始页面失败");
}
}
// 确保当前窗口处于活动状态
Window.Current.Activate();
}