• <1 minute

Code sample test

protectedasyncoverridevoid OnNavigatedTo(NavigationEventArgs e) {     while (App.MobileService.CurrentUser == null)     {        …

protectedasyncoverridevoid OnNavigatedTo(NavigationEventArgs e)

{

    while (App.MobileService.CurrentUser == null)

    {

        bool cancelled = false;

 

        try

        {

            awaitApp.MobileService.LoginAsync(

                MobileServiceAuthenticationProvider.Twitter);

        }

        catch (InvalidOperationException)

        {

            cancelled = true;

        }

 

        if (cancelled)

        {

            awaitnew Windows.UI.Popups.MessageDialog(

                    “You must login to use this app”, “Login”).ShowAsync();

        }

    }

 

    RefreshTodoItems();

}