Windows Phone,Page Loading:最佳方法

时间:2012-08-10 06:43:20

标签: windows-phone-7

我遇到需要根据条件加载页面的情况:

条件是

if( First time application is launched){

Load aggrement page;
}
else{

Load main Page;
}

最好的方法是什么? 我应该检查一下条件:

private void Application_Launching(object sender, LaunchingEventArgs e)
{

}

或者在initializeCOmponent()调用之前的主页面中?

1 个答案:

答案 0 :(得分:5)

尝试这样的事情:

private void Application_Launching(object sender, LaunchingEventArgs e)
{
    IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

    if (settings.ContainsKey("isRanFirstTime"))
        //Navigate to page 1
    else
    {
        settings.Add("isRanFirstTime, 1);
        //Navigate to page 2
    }
}

关于从App.xaml.cs重定向导航,请在Peter Torr的帖子中找到更多信息

Redirecting an initial navigation