internal void Refresh()
 {
     if (this._loadingInBuffer)
     {
         return;
     }
     this._commentsCount     = -1;
     this._fetchedComments   = new List <Comment>();
     this._user1List         = new List <User>();
     this._user2List         = new List <User>();
     this._commentsCountItem = (UCItem)null;
     this._panel.ClearItems();
     this._wallResponseData = (GetWallPostResponseData)null;
     this.LoadMoreCommentsInUI();
 }
        private void LoadMoreCommentsInBuffer(Action <bool> completionCallback)
        {
            int            countToRead  = this._commentsCount != -1 ? this._countToReload : this._countToLoad;
            bool           needWallPost = this._wallPostData == null;
            LikeObjectType likeObjType  = LikeObjectType.post;

            if (this._wallPostData != null && this._wallPostData.WallPost != null)
            {
                likeObjType = this._wallPostData.WallPost.GetLikeObjectType();
            }
            if (needWallPost || !this.IsWallPostAddedToUI)
            {
                this.SetInProgress(true, CommonResources.Loading);
            }
            WallService.Current.GetWallPostByIdWithComments(this._postId, this._ownerId, this._fetchedComments.Count, countToRead, this._commentsCount, needWallPost, (Action <BackendResult <GetWallPostResponseData, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                this.SetInProgress(false, "");
                if (res.ResultCode != ResultCode.Succeeded)
                {
                    completionCallback(false);
                }
                else
                {
                    if (this._commentsCount == -1)
                    {
                        EventAggregator.Current.Publish((object)new WallCommentsLikesUpdated()
                        {
                            OwnerId = this._ownerId,
                            WallPostId = this._postId,
                            CommentsCount = res.ResultData.Count,
                            LikesCount = res.ResultData.LikesAll.count
                        });
                        this._commentsCount = res.ResultData.Count;
                        this._runningCountOfComments = this._commentsCount;
                    }
                    this._user1List.AddRange((IEnumerable <User>)res.ResultData.Users);
                    this._user2List.AddRange((IEnumerable <User>)res.ResultData.Users2);
                    if (AppGlobalStateManager.Current.GlobalState.LoggedInUser != null)
                    {
                        this._user1List.Add(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                        this._user2List.Add(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                    }
                    this._groupsList.AddRange((IEnumerable <Group>)res.ResultData.Groups);
                    List <Comment> commentList = this._fetchedComments;
                    this._fetchedComments = res.ResultData.Comments;
                    foreach (Comment comment1 in commentList)
                    {
                        Comment comment = comment1;
                        if (!this._fetchedComments.Any <Comment>((Func <Comment, bool>)(c => c.cid == comment.cid)))
                        {
                            this._fetchedComments.Add(comment);
                        }
                    }
                    this._wallResponseData = res.ResultData;
                    if (this._wallResponseData.WallPost.to_id == 0L && this._wallPostData != null)
                    {
                        this._wallResponseData.WallPost = this._wallPostData.WallPost;
                    }
                    completionCallback(true);
                    if (!this._wallPostData.WallPost.IsNotExist)
                    {
                        return;
                    }
                    int num = (int)MessageBox.Show(CommonResources.WallPostIsNotAvailable, CommonResources.Error, MessageBoxButton.OK);
                    Navigator.Current.GoBack();
                }
            }))), this.PollId, this.PollOwnerId, likeObjType);
        }