跳至主要內容

Code sample test

在 十一月 1, 2012 上貼文

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();

}