//Most of this could be shared
        public void HandleLoginResult(System.Threading.Tasks.Task<Microsoft.WindowsAzure.MobileServices.MobileServiceUser> t, LoginPlatform platform)
        {
            if (t.Status == TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
            {
                //Save our app settings for next launch
                var settings = SettingsPresenter.Current;

                settings.UserId = t.Result.UserId;

                if (platform != null)
                    settings.AuthenticationProvider = (int)platform.Provider;

                settings.Save();

                    //Navigate to the Lists view
                    //RequestNavigate<WishListsViewModel>();
                var homecontroller = new HomeViewController();
                this.NavigationController.PushViewController(homecontroller, true);

            }
            else
            {

                //Show Error
                //ReportError("Login Failed!");
            }
        }
Example #2
0
        private void HandleLoginResult(Task<MobileServiceUser> t, LoginPlatform platform = null)
        {
            if (t.Status == TaskStatus.RanToCompletion && t.Result != null && !string.IsNullOrEmpty(t.Result.UserId))
            {
                //Save our app settings for next launch
                var settings = SettingsPresenter.Current;

                settings.UserId = t.Result.UserId;

                if (platform != null)
                {
                    settings.AuthenticationProvider = (int) platform.Provider;
                }

                settings.Save();
                RunOnUiThread(() =>
                {
                    Toast.MakeText(this, "Login Successful", ToastLength.Long).Show();
                    //Navigate to the Lists view
                    //RequestNavigate<WishListsViewModel>();
                    var i = new Intent(this, typeof (ItemListActivity));
                    i.AddFlags(ActivityFlags.ClearTop);
                    StartActivity(i);
                });
            }
            else
            {

                RunOnUiThread(() => { Toast.MakeText(this, "Login Failed", ToastLength.Long).Show(); });
                //Show Error
                //ReportError("Login Failed!");
            }
        }
 //Could be shared by
 public void Login(LoginPlatform platform)
 {
     RBAListPresenter.Current.Logout();
     RBAListPresenter.Current.MobileService.LoginAsync(this,platform.Provider).ContinueWith((t) =>
     {
         HandleLoginResult(t, platform);
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
Example #4
0
 private void Login(LoginPlatform platform)
 {
     RBAListPresenter.Current.Logout();
     RBAListPresenter.Current.MobileService.LoginAsync(this, platform.Provider).ContinueWith((t) => HandleLoginResult(t, platform));
 }