When app launches time need to show the registration page.once user registered it shouldn't goes to registration page need to go log in page. How to achieve this?
Asked
Active
Viewed 166 times
0
-
possible duplicate of [How to show different pages when app launches time in windows phone 7?](http://stackoverflow.com/questions/9664673/how-to-show-different-pages-when-app-launches-time-in-windows-phone-7) – Nogard Oct 10 '13 at 08:44
-
so you have RegPage.xaml and LoginPage.xaml. right ? – Mohamed Thaufeeq Oct 10 '13 at 08:48
1 Answers
0
Since, you are storing Passwords using Isolated Storage
, you can simply use this.
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
}
}
Don't forget to add this code in your 'LoginPage', this will restrict user not to back to 'MainPage' again;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
while (NavigationService.CanGoBack)
{
NavigationService.RemoveBackEntry();
}
}

Mohamed Thaufeeq
- 1,667
- 1
- 13
- 34
-
Yeah, I've copied the question from there. Unlike WP7, in WP8 Application.Current.RootFrame is undefined. And in Application_Launching handler, Application.Current.RootVisual is null. – Soonts Oct 10 '13 at 14:33
-
how you are saving the entered password? using DB or IsolatedStorage ? – Mohamed Thaufeeq Oct 11 '13 at 04:31
-
Yeah, but the wrong page is loaded before the right one, so the wrong view model gets initialized first.. – Soonts Oct 13 '13 at 23:51
-
You could check the iso storage in the app.xaml.cs > InitializePhoneApplication and change the UriMapper of the RootFrame to go to the LoginPage instead of MainPage. But if you do this, you'll need to subscribe to the back button call on the login page to not quit the app but navigato to the main page instead! And doing so, you'll need to clear the backstack so that a Back button push on the main page would not go back to the login page! Makes sense? – Depechie Jan 15 '14 at 10:18
-
there is an example of that on StackO itself! http://stackoverflow.com/questions/19229046/how-to-show-a-page-if-application-is-launched-for-the-first-time – Depechie Jan 20 '14 at 15:07