0

In the WMAppManifest.xml I've set page A as the default page.

While that is fine 99.9% of the time, I need the user to see page B, at app's first run.

I'm not sure where to start with this, except maybe checking (in page A) whether "firstRun" key exists in the app's IsolatedStorageSettings properties, and navigate the user to page B.

That sounds like a hack to me, though. Is there a good-practice solution?

EDIT: I've tried googling, but I'm not sure which keywords to use.

4

1 回答 1

2

定制UriMapper正是您所需要的。这是示例

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;
    }
}

whereAppSettings是一个用户定义的类来存储应用程序设置。

于 2013-09-09T12:01:14.317 回答