private void LoadCommentsFromBuffer()
 {
     Deployment.Current.Dispatcher.BeginInvoke((Action)(() =>
     {
         UCItem ucItem = this._reloadButtonItem;
         this._reloadButtonItem = (UCItem)null;
         int countLoadedOnUi = this.GetCountLoadedOnUI();
         int num1 = 0;
         if (countLoadedOnUi == 0)
         {
             num1 = this._fetchedComments.Count;
         }
         else
         {
             Comment oldestLoaded = this.GetOldestLoadedComment();
             if (oldestLoaded != null)
             {
                 Comment comment = this._fetchedComments.FirstOrDefault <Comment>((Func <Comment, bool>)(c =>
                 {
                     if (c.cid == oldestLoaded.cid)
                     {
                         return(c.from_id == oldestLoaded.from_id);
                     }
                     return(false);
                 }));
                 if (comment != null)
                 {
                     num1 = this._fetchedComments.IndexOf(comment);
                 }
             }
         }
         int num2 = countLoadedOnUi == 0 ? this._countToLoad : this._countToReload;
         List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
         for (int index = num1 - 1; index >= 0 && num1 - index <= num2; --index)
         {
             CommentItem commentItem = this.CreateCommentItem(this._fetchedComments[index]);
             itemsToInsert.Add((IVirtualizable)commentItem);
         }
         int num3 = countLoadedOnUi + itemsToInsert.Count;
         if (num3 < this._commentsCount)
         {
             UCItem reloadButton = this.CreateReloadButton(Math.Min(this._countToReload, this._commentsCount - num3));
             itemsToInsert.Add((IVirtualizable)reloadButton);
         }
         if (this._commentsCountItem == null)
         {
             this._commentsCountItem = this.CreateCommentsCountItem();
             itemsToInsert.Add((IVirtualizable)this._commentsCountItem);
         }
         itemsToInsert.Reverse(0, itemsToInsert.Count);
         bool keepItemsBelowIndexFixed = true;
         if (this.GetCountLoadedOnUI() == 0)
         {
             keepItemsBelowIndexFixed = false;
         }
         this._panel.InsertRemoveItems(this.GetIndexToInsertItems(), itemsToInsert, keepItemsBelowIndexFixed, (IVirtualizable)ucItem);
         this.CallLoadedCallback();
     }));
 }
        private Comment GetOldestLoadedComment()
        {
            CommentItem commentItem = this._panel.VirtualizableItems.FirstOrDefault <IVirtualizable>((Func <IVirtualizable, bool>)(vi => vi is CommentItem)) as CommentItem;

            if (commentItem != null)
            {
                return(commentItem.Comment);
            }
            return((Comment)null);
        }
        public void PostComment(string text, long replyCid, long replyUid, bool fromGroup, List <IOutboundAttachment> attachments, Action <bool> callback, StickerItemData stickerItemData = null, string stickerReferrer = "")
        {
            if (!this.CanPostComment(text, attachments, stickerItemData))
            {
                callback(false);
            }
            else if (this._postingComment)
            {
                callback(false);
            }
            else
            {
                this._postingComment = true;
                this.SetInProgress(true, "");
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                WallService.Current.AddComment(this._postId, this._ownerId, text, replyCid, fromGroup, attachments.Select <IOutboundAttachment, string>((Func <IOutboundAttachment, string>)(a => a.AttachmentId)).ToList <string>(), (Action <BackendResult <Comment, ResultCode> >)(res =>
                {
                    this.SetInProgress(false, "");
                    this._postingComment = false;
                    Execute.ExecuteOnUIThread((Action)(() =>
                    {
                        bool flag = res.ResultCode == ResultCode.Succeeded;
                        if (flag)
                        {
                            CommentItem commentItem = this.CreateCommentItem(res.ResultData);
                            this._runningCountOfComments = this._runningCountOfComments + 1;
                            this.UpdateCommentsCountItem();
                            MyVirtualizingPanel2 panel = this._panel;
                            int count = this._panel.VirtualizableItems.Count;
                            List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
                            itemsToInsert.Add((IVirtualizable)commentItem);
                            int num = 0;
                            // ISSUE: variable of the null type

                            panel.InsertRemoveItems(count, itemsToInsert, num != 0, null);
                            this._fetchedComments.Add(res.ResultData);
                            EventAggregator current = EventAggregator.Current;
                            WallCommentIsAddedDeleted commentIsAddedDeleted = new WallCommentIsAddedDeleted();
                            commentIsAddedDeleted.Added = true;
                            long toId = this._wallPostData.WallPost.to_id;
                            commentIsAddedDeleted.OwnerId = toId;
                            long id = this._wallPostData.WallPost.id;
                            commentIsAddedDeleted.WallPostId = id;
                            current.Publish(commentIsAddedDeleted);
                        }
                        callback(flag);
                    }));
                }), stickerItemData == null ? 0 : stickerItemData.StickerId, stickerReferrer);
            }
        }
        public void DeleteComment(CommentItem commentItem)
        {
            this._panel.RemoveItem((IVirtualizable)commentItem);
            this._runningCountOfComments = this._runningCountOfComments - 1;
            this.UpdateCommentsCountItem();
            EventAggregator           current = EventAggregator.Current;
            WallCommentIsAddedDeleted commentIsAddedDeleted = new WallCommentIsAddedDeleted();

            commentIsAddedDeleted.Added = false;
            long id = this._wallPostData.WallPost.id;

            commentIsAddedDeleted.WallPostId = id;
            long toId = this._wallPostData.WallPost.to_id;

            commentIsAddedDeleted.OwnerId = toId;
            current.Publish((object)commentIsAddedDeleted);
            WallService.Current.DeleteComment(this._ownerId, commentItem.Comment.cid, (Action <BackendResult <ResponseWithId, ResultCode> >)(res => {}));
        }
 public void ReplyToComment(CommentItem commentItem)
 {
     this._replyCommentAction(commentItem);
 }
 private void EditComment(CommentItem commentItem)
 {
     commentItem.Comment.owner_id = this._wallPostData.WallPost.to_id;
     ParametersRepository.SetParameterForId("EditWallComment", (object)commentItem.Comment);
     Navigator.Current.NavigateToNewWallPost(Math.Abs(this._wallPostData.WallPost.to_id), this._wallPostData.WallPost.to_id < 0L, 0, false, false, false);
 }
 private void SeeAllLikes(CommentItem item)
 {
     Navigator.Current.NavigateToLikesPage(item.OwnerId, item.Comment.cid, 1, item.LikesCount);
 }