/// <summary>
        /// Returns the User info for the provided user, or authenticated user if none provided.
        /// </summary>
        /// <param name="userId">user id</param>
        /// <returns>User</returns>
        public async Task<User> GetUserInfo(string userId = null)
        {
            // if no ID provided and no ID stored, nothing to do here
            if (String.IsNullOrEmpty(userId) && String.IsNullOrEmpty(UserSettings.Settings.GoodreadsUserID))
                return null;

            if (String.IsNullOrEmpty(userId))
            {
                // if no ID provided, use stored one and refresh authenticated user's info
                user = await GetUserInfo(UserSettings.Settings.GoodreadsUserID);

                return user;
            }                
            else 
            {
                //otherwise return provided user's info
                return await GetUserInfo(userId);
            }
        }
 /// <summary>
 /// Load all data we have from storage
 /// </summary>
 private void LoadCache()
 {
     user = UserSettings.Settings.UserInfo;
 }
Beispiel #3
0
        public async Task LoadFullData(string id = null)
        {
            user = id == null
                ? await _gr.GetUserInfo(user.Id)
                : await _gr.GetUserInfo(id);

            NotifyPropertyChanged("UserName");
            NotifyPropertyChanged("UserSmallImageUrl");
            NotifyPropertyChanged("UserImageUrl");
            NotifyPropertyChanged("UserLink");
            NotifyPropertyChanged("UserAge");
            NotifyPropertyChanged("UserAbout");
            NotifyPropertyChanged("UserGender");
            NotifyPropertyChanged("UserLocation");
            NotifyPropertyChanged("UserWebsite");
            NotifyPropertyChanged("UserJoined");
            NotifyPropertyChanged("UserLastActive");
            NotifyPropertyChanged("UserInterests");
            NotifyPropertyChanged("UserFavoriteBooks");
            NotifyPropertyChanged("UserFriendsCount");
            NotifyPropertyChanged("UserGroupsCount");
            NotifyPropertyChanged("UserReviewsCount");

            //GenerateUserDetails();

            CurrentlyReading.Clear();
            foreach (var userStatus in user.User_statuses.User_status)
            {
                CurrentlyReading.Add(new UserStatusViewModel(userStatus));
            }

            Updates.Clear();
            foreach (var userUpdate in user.Updates.Update)
            {
                Updates.Add(new UpdateViewModel(userUpdate));
            }

            Shelves.Clear();
            foreach (var shelf in user.User_shelves.User_shelf)
            {
                Shelves.Add(new ShelvesViewModel(shelf));
            }
        }
Beispiel #4
0
 public UserViewModel(User user)
 {
     this.user = user;
 }