Пример #1
0
 private void LogInForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         SignInButton.PerformClick();
     }
 }
Пример #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <ImageButton> e)
        {
            base.OnElementChanged(e);

            var citoButton = e.NewElement.CitoButton;

            if (citoButton == null)
            {
                return;
            }

            var externalLogin = e.NewElement.ExternalLogin;

            if (externalLogin == ImageButton.Social.Facebook)
            {
                var facebookLoginButton = new LoginButton(Forms.Context);
                facebookLoginButton.SetReadPermissions(new string[] { "public_profile", "email" });

                citoButton.Clicked += (sender, args) =>
                {
                    if (!Connectivity.CheckConnectionAndDisplayToast())
                    {
                        return;
                    }

                    if (FacebookLogin.FacebookLoggedIn)
                    {
                        App.Locator.Prelogin.ExternalLoginCommand.Execute(null);
                        return;
                    }

                    facebookLoginButton.PerformClick();
                    FacebookLogin.IsFacebookLogin = true;
                };
            }
            else if (externalLogin == ImageButton.Social.Google)
            {
                var googleLoginButton = new SignInButton(Forms.Context);
                citoButton.Clicked += (sender, args) =>
                {
                    if (!Connectivity.CheckConnectionAndDisplayToast())
                    {
                        return;
                    }

                    googleLoginButton.PerformClick();
                    if (GoogleLogin.MyGoogleApiClient.IsConnecting)
                    {
                        return;
                    }

                    GoogleLogin.MyGoogleApiClient.Reconnect();
                    GoogleLogin.IsGoogleLogin = true;
                    GoogleLogin.IntentHandled = true;
                };
            }
            else
            {
                return;
            }
        }