public UserAccountViewModel(UserAccount userAccount) { UserAccount = userAccount; AccountName = userAccount.AccountName; var dataSource = new GPlusDataSource(userAccount.GetGoogleCredential(), GoogleCloudExtensionPackage.VersionedApplicationName); var personTask = dataSource.GetProfileAsync(); // TODO: Show the default image while it is being loaded. ProfilePictureAsync = AsyncPropertyValueUtils.CreateAsyncProperty(personTask, x => x.Image.Url); NameAsync = AsyncPropertyValueUtils.CreateAsyncProperty(personTask, x => x.DisplayName, Resources.CloudExplorerLoadingMessage); }
private static async Task <UserAccount> GetUserAccountForRefreshToken(string refreshToken) { var result = new UserAccount { RefreshToken = refreshToken, ClientId = s_extensionCredentials.ClientId, ClientSecret = s_extensionCredentials.ClientSecret }; var plusDataSource = new GPlusDataSource(result.GetGoogleCredential(), GoogleCloudExtensionPackage.VersionedApplicationName); var person = await plusDataSource.GetProfileAsync(); result.AccountName = person.Emails.FirstOrDefault()?.Value; return(result); }
private static async Task<UserAccount> GetUserAccountForRefreshToken(string refreshToken) { var result = new UserAccount { RefreshToken = refreshToken, ClientId = s_extensionCredentials.ClientId, ClientSecret = s_extensionCredentials.ClientSecret }; var plusDataSource = new GPlusDataSource(result.GetGoogleCredential(), GoogleCloudExtensionPackage.VersionedApplicationName); var person = await plusDataSource.GetProfileAsync(); result.AccountName = person.Emails.FirstOrDefault()?.Value; return result; }