Пример #1
0
        private async Task LoadUserData()
        {
            var userName = await SecretsHelper.GetUserName();

            await Task.Delay(1000);

            Account account = await Accounts.GetAccount(userName);

            UserName = account.Url;
            Points   = account.Reputation;
            GalleryProfile galleryProfile = await Accounts.GetGalleryProfile(userName);

            Trophies = new ObservableCollection <Trophy>(galleryProfile.Trophies);
            await Task.Delay(500);

            await LoadAlbums(userName);

            await Task.Delay(500);

            await LoadImages(userName);

            await Task.Delay(500);

            await LoadFavourites(userName);
        }
        private async void Init()
        {
            await Task.Delay(1000);

            Account account = await Accounts.GetAccount();

            UserName = account.Url;
            Points   = account.Reputation;
            GalleryProfile galleryProfile = await Accounts.GetGalleryProfile();

            Trophies = new ObservableCollection <Trophy>(galleryProfile.Trophies);
            await Task.Delay(500);

            await LoadAlbums();

            await Task.Delay(500);

            await LoadImages();
        }
Пример #3
0
        /// <summary>The totals for a users gallery information.</summary>
        /// <param name="username">The user account. Default: me</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="T:Imgur.API.ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="T:Imgur.API.MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task <IGalleryProfile> GetGalleryProfileAsync(string username = "******")
        {
            if (string.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentNullException(nameof(username));
            }
            if (username.Equals("me", StringComparison.OrdinalIgnoreCase) && this.ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException("OAuth2Token", "OAuth authentication required.");
            }
            string          url = string.Format("account/{0}/gallery_profile", (object)username);
            IGalleryProfile galleryProfile;

            using (HttpRequestMessage request = this.ImageRequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                GalleryProfile profile = await this.SendRequestAsync <GalleryProfile>(request).ConfigureAwait(false);

                galleryProfile = (IGalleryProfile)profile;
            }
            return(galleryProfile);
        }