Search code examples
c#windows-phone-8windows-phone

How to implement a login/register flow in windows phone 8


I'm trying to implement the login/register/forgot password flow for my first app in windows phone.

The idea main points of the result are:

  • The login form is accessible from many points of the app, when the user attempts to make an action that requires him to be logged in the system.
  • The login form must show the "register" option, showing a new screen with the register form
  • When the user closes the register form must return to the login form

A) I explored the Add/New Item menu in Visual Studio and the Content Dialog seems to be prepared for that functionallity, since its template xaml is a login screen. So I created a LoginDialog and a RegisterDialog from the ContentDialog template. Am I right?

B) The "sign in" button closes immediatly the Dialog, whats is the common pattern to make the user wait while the request is sent across the network and show the possible errors that may happen

C) How should I implement the navigation between ContentDialogs by the way I added a button to the LoginDialog:

private async void RegisterButton_Click(object sender, RoutedEventArgs e)
{            
    this.Hide();
    await new RegisterDialog().ShowAsync();
}

How can I make the RegisterDialog to return to the Login dialog on close?

D) The dialog get closed when I press the Primary or Secondary button. How can I avoid it to close to show validation errors (like invalid password)


Solution

  • In my application I implemented it by putting both the Sign in option and the Register option on a MessageDialog, which is shown when the user tries to log in, so you don't need to put the Register option on the Sign in page.

    I added separate pages, not content dialogs. I think it's a better approach, because this way if you get an error, the page won't "close", like a ContentDialog does, and you can handle the navigation very easily with simple GoBack and Navigate calls.