Exemplo n.º 1
0
        partial void AnonymousLogin(NSObject sender)
        {
            // sign in anonymously
            HMFTask <NSObject> signInAnonymously = AGCAuth.GetInstance().SignInAnonymously();

            signInAnonymously.AddOnSuccessCallback((result) =>
            {
                AGCSignInResult signInResult = result as AGCSignInResult;
                Console.WriteLine("AnonymousLogin success");
                OpenUserInfoView(signInResult.User);
            });
            signInAnonymously.AddOnFailureCallback((error) =>
            {
                Console.WriteLine("AnonymousLogin failed");
            });
        }
Exemplo n.º 2
0
        private void RegisterEmailAccount()
        {
            string email            = accountText.Text;
            string password         = passwordText.Text;
            string verificationCode = codeText.Text;
            // register email account
            HMFTask <NSObject> register = AGCAuth.GetInstance().CreateUserWithEmail(email, password, verificationCode);

            register.AddOnSuccessCallback((result) =>
            {
                AGCSignInResult user = result as AGCSignInResult;
                Console.WriteLine("Account register success");
                OpenUserInfoView(user.User);
            });
            register.AddOnFailureCallback((error) =>
            {
                Console.WriteLine("Email create failed");
            });
        }
Exemplo n.º 3
0
        private void RegisterPhoneAccount()
        {
            string countryCode      = "90";
            string phoneNumber      = accountText.Text;
            string password         = passwordText.Text;
            string verificationCode = codeText.Text;
            // register phone account
            HMFTask <NSObject> register = AGCAuth.GetInstance().CreateUserWithCountryCode(countryCode, phoneNumber, password, verificationCode);

            register.AddOnSuccessCallback((result) =>
            {
                AGCSignInResult user = result as AGCSignInResult;
                Console.WriteLine("account register success --- >" + user.User.DisplayName);
                OpenUserInfoView(user.User);
            });
            register.AddOnFailureCallback((error) =>
            {
                Console.WriteLine("account register failed-->" + error);
            });
        }
Exemplo n.º 4
0
        private void SignIn(AGCAuthCredential credential)
        {
            if (credential != null)
            {
                HMFTask <NSObject> signIn = AGCAuth.GetInstance().SignIn(credential);

                signIn.AddOnSuccessCallback((result) =>
                {
                    AGCSignInResult user = result as AGCSignInResult;
                    Console.WriteLine("sign in success");
                    OpenUserInfoView(user.User);
                });
                signIn.AddOnFailureCallback((error) =>
                {
                    Console.WriteLine("sign in failed-->" + error);
                });
            }
            else
            {
                Console.WriteLine("no credential");
            }
        }