private void btnSignUp_Click()
        {
            if (btnMale.Checked)
            {
                presenter.UpdateGender(btnMale.Text);
            }
            else if (btnFemale.Checked)
            {
                presenter.UpdateGender(btnFemale.Text);
            }
            else
            {
                presenter.UpdateGender("");
            }

            CheckBox acceptTermChckBx = FindViewById <CheckBox>(Resource.Id.isAcceptTerm);

            invalidTxtView = FindViewById <TextView>(Resource.Id.invalidTxtView5);

            if (acceptTermChckBx.Checked)
            {
                invalidTxtView.Visibility = ViewStates.Gone;
                presenter.SignUp();
            }
            else
            {
                invalidTxtView.Visibility = ViewStates.Visible;
            }
        }
Example #2
0
        private void LoginFacebook()
        {
            var auth = CommonUtils.LoginFacebook();

            //isSigninSocial = true;

            auth.Completed += async(object sender, AuthenticatorCompletedEventArgs eventArgs) =>
            {
                if (eventArgs.IsAuthenticated)
                {
                    var request = new OAuth2Request(
                        "GET",
                        new Uri("https://graph.facebook.com/me?fields=name,email"),
                        null,
                        eventArgs.Account);

                    var fbResponse = await request.GetResponseAsync();

                    var json = fbResponse.GetResponseText();

                    var    fbUser = JsonConvert.DeserializeObject(json);
                    string token  = eventArgs.Account.Properties["access_token"];
                    var    email  = fbUser.ToString().Split(",")[1].Split(":")[1].Trim().Split("\"")[1];
                    presenter.UpdateEmail(email);
                    presenter.UpdateToken(token);
                    presenter.SignUp();
                }
            };

            auth.Error += (sender, eventArgs) =>
            {
                //isSignupSocial = false;
                OAuth2Authenticator auth2 = (OAuth2Authenticator)sender;
                auth2.ShowErrors = false;
                auth2.OnCancelled();
            };

            StartActivity(auth.GetUI(this));
        }