在WMAppManifest.xml
我将页面A设为默认页面。
虽然99.9%的时间都很好,但我需要用户在应用首次运行时看到第B页。
我不知道从哪里开始,除了检查(在页面A中)应用程序的IsolatedStorageSettings
属性中是否存在“firstRun”键,并将用户导航到页面B.
但这对我来说听起来像是一个黑客。有没有良好的实践解决方案?
编辑:我尝试使用谷歌搜索,但我不确定使用哪些关键字。答案 0 :(得分:2)
自定义UriMapper
正是您所需要的。这里is the example。
public class YourUriMapper : UriMapperBase
{
public override Uri MapUri(Uri uri)
{
if (uri.OriginalString == "/PageA.xaml")
{
if (AppSettings.FirstRun == true)
{
uri = new Uri("/PageB.xaml", UriKind.Relative);
}
else
{
uri = new Uri("/PageA.xaml", UriKind.Relative);
}
}
return uri;
}
}
其中AppSettings
是用于存储应用程序设置的用户定义类。