我有一個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