Example #1
0
        private async void ThumbsUpCommandExecute(long?obj)
        {
            if (obj > 0)
            {
                await this._netWorkServices.GetAsync <Dictionary <string, object> >("Common", "ThumbsUpComment", new
                {
                    commentId       = obj.Value,
                    commentThreadId = Global.Enums.CommentType.R_SO_4_.ToString() + Id,
                    thumbsUp        = true
                });

                var query = HotComments.Select((x, i) => new { Model = x, Index = i })
                            .FirstOrDefault(x => x.Model.CommentId == obj);
                if (query != null)
                {
                    query.Model.LikedCount++;
                    HotComments.RemoveAt(query.Index);
                    HotComments.Insert(query.Index, query.Model);
                    return;
                }
                query = NewComments.Select((x, i) => new { Model = x, Index = i })
                        .FirstOrDefault(x => x.Model.CommentId == obj);
                if (query != null)
                {
                    query.Model.LikedCount++;
                    NewComments.RemoveAt(query.Index);
                    NewComments.Insert(query.Index, query.Model);
                }
            }
        }
Example #2
0
        private async void AddCommentCommandExecute(string commentContent)
        {
            if (string.IsNullOrEmpty(commentContent) || !Id.HasValue)
            {
                return;
            }
            var netWorkDataResult = await this._netWorkServices.GetAsync <Comment>("Common", "AddComment", new
            {
                resourceId = Id.Value,
                type       = Global.Enums.CommentType.R_SO_4_,
                content    = commentContent
            });

            if (netWorkDataResult.Successed)
            {
                NewComments.Insert(0, netWorkDataResult.Data);
            }
            else
            {
                //todo 显示提示信息
            }
        }