当app启动时需要显示注册page.once用户注册它不应该去注册页面需要登录页面。怎么做到这一点?
答案 0 :(得分:0)
由于您使用Isolated Storage
存储密码,因此您只需使用此密码即可。
public MainPage()
{
InitializeComponent();
Loaded += MainPage_Loaded;
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains("LoginPassword"))
{
// so, if login password has already registered, it will redirect to LoginPage
NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative));
//else it will be in MainPage where user can enter their password
}
}
不要忘记在“登录页面”中添加此代码,这将限制用户不再返回“MainPage”;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
while (NavigationService.CanGoBack)
{
NavigationService.RemoveBackEntry();
}
}