private async Task QueryComment(int noteid)
        {
            if (CommentIndex == 0)
            {
                if (CommentList == null)
                {
                    CommentList = new ObservableCollection<CommentsResult>();
                    commentListView.ItemsSource = CommentList;
                }
                else
                {
                    CommentList.Clear();
                }
            }

            int index = 0;
            if (CommentList.Count != 0)
            {
                index = CommentList[CommentList.Count - 1].Id - 1;
            }

            List<CommentsResult> result = new List<CommentsResult>();

            CommonProvider common = new CommonProvider();
            result = await common.QueryComment(noteid.ToString(), index);

            result.ForEach(x => CommentList.Add(x));

            CommentIndex++;
        }
 public async Task QueryTopicLastTest()
 {
     CommonProvider common = new CommonProvider();
     List<TopicLastResult> user = await common.QueryTopicLast("26293", 0);
     Assert.IsNotNull(user);
 }
 public async Task QueryUserInfo()
 {
     CommonProvider common = new CommonProvider();
     UserBaseInfo user = await common.QueryUserInfo("2e128e04325c");
     Assert.IsNotNull(user);
 }
 private async Task QueryBaseInfo()
 {
     if (IsSelf)
     {
         UserContentProvider user = new UserContentProvider();
         baseInfo = await user.QueryBaseInfo(GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken);
     }
     else
     {
         CommonProvider common = new CommonProvider();
         baseInfo = await common.QueryUserInfo(currentUserId);
     }
     Avatar = new Uri(baseInfo.Avatar);
     FollowerCount = baseInfo.FollowersCount;
     FollowingCount = baseInfo.FollowingCount;
     LikedNotesCount = baseInfo.LikedNotesCount;
     BookmarksCount = baseInfo.BookmarksCount;
     SubscribingCount = baseInfo.SubscribingCollectionsCount + baseInfo.SubscribingNotebooksCount;
     TotalWordage = baseInfo.TotalWordage;
     TotalLikesReceived = baseInfo.TotalLikesReceived;
     NotebooksCount = baseInfo.NotebooksCount;
     currentUserId = baseInfo.Id.ToString();
 }
        private async Task QueryLast()
        {
            if (SelectedItem == null) return;

            if (lastPage == 0)
            {
                if (LastNotes == null)
                {
                    LastNotes = new ObservableCollection<TopicLastItem>();
                }
                else
                {
                    LastNotes.Clear();
                }
            }

            CommonProvider common = new CommonProvider();
            List<TopicLastResult> result = await common.QueryTopicLast(SelectedItem.Id.ToString(), lastPage);

            result.ForEach(x => LastNotes.Add(ConvertToTopicLastItem(x)));

            if (LastNotes?.Any() == true)
            {
                lastPage = LastNotes.Last().Id - 1;
            }

        }
        private async Task QueryTrending(DiscoverItem item)
        {
            CommonProvider common = new CommonProvider();
            List<TrendingResult> result = new List<TrendingResult>();

            if (pageIndex == 0)
            {
                if (TrendingList == null)
                {
                    TrendingList = new ObservableCollection<TrendingResult>();
                }
                else
                {
                    TrendingList.Clear();
                }
            }

            if (TypeSelectedItem.HotType != HotTopicType.None)
            {
                result = await common.QueryDiscover(TypeSelectedItem.HotType, pageIndex + 1, 20, new List<TrendingResult>(TrendingList));
            }

            if (TypeSelectedItem.Type != TopicType.None)
            {
                int index = 0;
                if (TrendingList.Count != 0)
                {
                    index = TrendingList[TrendingList.Count - 1].RecommendedAt - 1;
                }
                result = await common.QueryDiscover(TypeSelectedItem.Type, index, 20, 20);
            }

            result.ForEach(x => TrendingList.Add(x));

            pageIndex++;
        }