public GoogleProfile(UserProfileGoogle userProfile)
 {
     InitializeComponent();
     user = new User()
     {
         Name = userProfile.DisplayName, Image = userProfile.Image.Url
     };
     BindingContext = userProfile;
 }
Пример #2
0
        public static async Task <UserProfileGoogle> GetUserProfileAsync(TokenGoogle Token)
        {
            //using System.Net.Http;
            //using System.Net.Http.Headers;
            var requestUrl = string.Format("https://www.googleapis.com/plus/v1/people/me?access_token={0}", Token.AccessToken);
            var httpCilent = new HttpClient();
            var response   = await httpCilent.PostAsync(requestUrl, null);

            if (response.IsSuccessStatusCode)
            {
                var body = await response.Content.ReadAsStringAsync();

                //using Newtonsoft.Json;
                UserProfileGoogle UserGoogle = JsonConvert.DeserializeObject <UserProfileGoogle>(body);
                return(UserGoogle);
            }
            else
            {
                return(new UserProfileGoogle());
            }
        }