Windows 8 windows 8中辅助活动磁贴的问题
我有一个问题与第二个活瓦。我把它固定在我的应用程序中,我想要 它可以让用户找到一个深层链接,并将其固定在那里。 在App.xaml.cs文件中,我将其添加到onlaunched事件中:Windows 8 windows 8中辅助活动磁贴的问题,windows-8,Windows 8,我有一个问题与第二个活瓦。我把它固定在我的应用程序中,我想要 它可以让用户找到一个深层链接,并将其固定在那里。 在App.xaml.cs文件中,我将其添加到onlaunched事件中: if (rootFrame.Content == null) { // Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren // u
if (rootFrame.Content == null)
{
// Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren
// und die neue Seite konfigurieren, indem die erforderlichen Informationen als Navigationsparameter
// übergeben werden
if (!string.IsNullOrEmpty(args.Arguments))
{
rootFrame.Navigate(typeof(qurandb));//, args.Arguments);
}
else
{
// rootFrame.Navigate(typeof(qurandb), args.Arguments);
rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups");
}
/* if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups"))
{
throw new Exception("Failed to create initial page");
} */
}
我的问题是,这只有在应用程序第一次启动时才起作用。当我稍后单击辅助磁贴(应用程序是resume)时,我没有到达我想要的目的地,而是到达了我暂停应用程序时的位置
有人能帮我吗?您需要按如下方式处理OnResuming事件: 在你的App.xaml.cs中
public App()
{
//...
this.Resuming += OnResuming;
//...
}
//...
private void OnResuming(object sender, object e)
{
//there are no args here to access. So need to figure out some way to decide what page to show
bool showShowQuranDb = true; //your logic here
if (shouldShowQuranDb)
{
rootFrame.Navigate(typeof(qurandb));
}
else
{
rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups");
}
}
单击辅助磁贴时,将调用应用程序的OnLaunched事件。您提供的代码假定只有当
rootFrame.Content
为空时才会调用它,并且如果您的应用程序已在运行,则不会导航到相应的页面。代码需要处理帧内容不为null的情况
if (rootFrame.Content == null)
{
...
} else {
// Need to handle the case where rootFrame.Content is not null
}
非常感谢到目前为止…但当我无法访问互动程序的参数时,我可以使用什么逻辑?好吧,你可以使用你需要的任何逻辑-因为你的应用程序在挂起时实际上在内存中。这意味着,当您获得OnResuming事件时,您的所有内存状态都将保留。此外,在暂停时,您可以将一些状态保存在内存中或本地文件中,并在简历中重新读取。谢谢。我提供的代码在OnLaunched事件中..我是否正确,当我单击辅助磁贴时,我需要向OnActivated事件添加代码,因为这是触发的?OnLaunched事件将被触发-启动是一种特定的激活。我已经更新了我的回复。