Пример #1
0
                public void FacebookCredentialResult(string response, BindResult result)
                {
                    // make sure we got a valid access token
                    if (FacebookManager.Instance.IsAuthenticated( ))
                    {
                        // now attempt to get their basic info
                        FacebookManager.Instance.FetchBasicInfo(delegate(bool fbResult)
                        {
                            // if there was no problem, we are logged in and can send this up to Rock
                            if (fbResult == true)
                            {
                                // now login via rock with the facebook credentials to verify we're good
                                RockApi.Post_Auth_FacebookLogin(FacebookManager.Instance.BasicInfo, delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                                {
                                    if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                                    {
                                        UserID       = "facebook_" + FacebookManager.Instance.GetUserID( );
                                        RockPassword = "";

                                        AccessToken = FacebookManager.Instance.AccessToken;

                                        AccountType = BoundAccountType.Facebook;

                                        // save!
                                        SaveToDevice( );

                                        result(true);
                                    }
                                    else
                                    {
                                        result(false);
                                    }
                                });
                            }
                            else
                            {
                                // didn't work out.
                                result(false);
                            }
                        });
                    }
                    else
                    {
                        result(false);
                    }
                }