async public Task <bool> Authenticate(string provider)
        {
            var success = false;

            try
            {
                // Sign in with provider specific login using a server-managed flow
                user = await Locator.Instance.MobileService.LoginAsync(ApplicationCapabilities.ConvertString2IdentityProvider(provider));

                if (user != null)
                {
                    success = true;
                }
                else
                {
                    success = false;
                }
            }
            catch (Exception ex)
            {
                //var messageDialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Authentication Failed");
                //await messageDialog.ShowAsync();
            }

            return(success);
        }
        public async Task <bool> Authenticate(string provider)
        {
            var success = false;

            try
            {
                // Sign in with Facebook login using a server-managed flow.
                if (user == null)
                {
                    user = await Locator.Instance.MobileService.LoginAsync(
                        UIApplication.SharedApplication.KeyWindow.RootViewController,
                        ApplicationCapabilities.ConvertString2IdentityProvider(provider));

                    //if (user != null)
                    //{
                    //    UIAlertView avAlert = new UIAlertView("Authentication", "You are now logged in " + user.UserId, null, "OK", null);
                    //    avAlert.Show();
                    //}
                }

                success = true;
            }
            catch (Exception ex)
            {
                //UIAlertView avAlert = new UIAlertView("Authentication failed", ex.Message, null, "OK", null);
                //avAlert.Show();
            }

            return(success);
        }
예제 #3
0
        public async Task <bool> Authenticate(string provider)
        {
            var success = false;

            try
            {
                // Sign in with Facebook login using a server-managed flow.
                user = await Locator.Instance.MobileService.LoginAsync(this, ApplicationCapabilities.ConvertString2IdentityProvider(provider));

                success = true;
            }
            catch (Exception ex)
            {
                //CreateAndShowDialog(ex.Message, "Authentication failed");
            }

            return(success);
        }