我有一个WP7应用程序,我需要根据用户是否已注册来更改启动页面。假设如果用户已注册,那么我需要将他重定向到欢迎页面,如果不是,则注册页面。如何更改WP7应用程序的启动页面
我已经尝试了几种方法是我的代码,但它给了我一个参数处置异常。
为了实现上述功能,我在我的MainPage.xaml构造函数中编写了导航代码。检查用户注册信息是否不在独立存储中,然后重定向到其他页面。
private void IsAgreeed()
{
try
{
isoStorage = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoStorage.FileExists("DataBase/MyPhoneNumber.txt"))
{
this.NavigationService.Navigate(new Uri("/EULA.xaml", UriKind.Relative));
}
else
{
return;
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
上面的代码在第一次使用它时正常工作,但如果我关闭应用程序并重新启动它,它将引发异常参数处置异常。
谢谢; 无
可能的重复[如何更改WP7 Silverlight应用程序的启动页?](http://stackoverflow.com/questions/3892271/how-do-i-change-the-startup-page-on- a-wp7-silverlight-app) – ctacke 2010-12-14 17:07:33
Bah,错误的链接。这里是现有的问题:http://stackoverflow.com/questions/4303403/windows-phone-7-sign-in-screen-redirect – ctacke 2010-12-14 17:09:07
尝试:使用(IsolatedStorageFile isoStorage = IsolatedStorageFile.GetUserStoreForApplication()) {//您的代码} – eSniff 2010-12-14 21:45:09