示例#1
0
 public void Set(FacebookInfo info)
 {
     if (null != info)
     {
         this.localSettings.Values[FacebookAccessTokenKey] = string.IsNullOrWhiteSpace(info.AccessToken) ? null : info.AccessToken;
         this.localSettings.Values[FacebookProfileIdKey]   = string.IsNullOrWhiteSpace(info.ProfileId) ? null : info.ProfileId;
     }
     else
     {
         this.localSettings.Values[FacebookAccessTokenKey] = null;
         this.localSettings.Values[FacebookProfileIdKey]   = 0;
     }
 }
示例#2
0
        private async void OnSessionStateChanged(object sender, SessionStateChangedEventArgs e)
        {
            switch (e.SessionState)
            {
            case FacebookSessionState.Opened:
                this.DisplayLoading(true);

                try
                {
                    var registration = new Registration()
                    {
                        FacebookAccessToken     = this.loginButton.CurrentSession.AccessToken,
                        FacebookTokenExpiration = this.loginButton.CurrentSession.Expires,
                    };

                    var token = await this.api.Login(registration);

                    if (null != token)
                    {
                        var fb = new FacebookInfo()
                        {
                            AccessToken = this.loginButton.CurrentSession.AccessToken,
                            ProfileId   = this.loginButton.CurrentSession.FacebookId,
                        };

                        this.data.Set(fb);

                        this.GeoLocation();

                        this.Frame.Navigate(typeof(WantSection));
                    }
                }
                catch
                {
                    this.api_CannotConnectToServers(this, EventArgs.Empty);
                }
                break;

            case FacebookSessionState.Closed:
                this.api.Logout();
                break;
            }

            this.DisplayLoading(false);
        }
示例#3
0
 public User(Guid id, Token token, Country country, bool dismissedLocationPopup, Coordinate location, DateTime?lastLocationUpdate, bool dismissedRateAppPopup, bool dismissedSignUpPopup, bool isBumbleRegistered, Email email, string firstName, string lastName, bool isFacebookRegistered, bool isTwitterRegistered, FacebookInfo facebookInfo, TwitterInfo twitterInfo, string twitterHandle, int appUsageCount)
     : this(id, token)
 {
     this.Country = country;
     this.DismissedLocationPopup   = dismissedLocationPopup;
     this.LastKnownGeneralLocation = location;
     this.LastLocationUpdate       = lastLocationUpdate;
     this.DismissedRateAppPopup    = dismissedRateAppPopup;
     this.DismissedSignUpPopup     = dismissedSignUpPopup;
     this.IsBumbleRegistered       = isBumbleRegistered;
     this.Email                = email;
     this.FirstName            = firstName;
     this.LastName             = lastName;
     this.IsFacebookRegistered = isFacebookRegistered;
     this.IsTwitterRegistered  = isTwitterRegistered;
     this.FacebookInfo         = facebookInfo;
     this.TwitterInfo          = twitterInfo;
     this.TwitterHandle        = twitterHandle;
     this.AppUsageCount        = appUsageCount;
 }