Exemplo n.º 1
0
        /// <summary>
        /// 刷新评论消息
        /// </summary>
        public async Task RefreshCommentMessagesAsync()
        {
            IsActive = true;
            commentMessageStringBuilder.Clear();
            commentMessageStringBuilder.Append("0");
            await CommentMessages.ClearAndReloadAsync();

            IsActive = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载设计时数据
        /// </summary>
        private void LoadDesignData()
        {
            string commentJson = "{\"comment_messages\":[{\"id\":3984488,\"content\":\"\",\"created_at\":1494394824,\"sended_at\":\"2017-05-10 13:40\",\"sender\":{\"name\":\"X_arcsinw\",\"avatar\":\"http://tva2.sinaimg.cn/crop.0.0.480.480.1024/e5b9045djw8ea3nvwosj3j20dc0dcaam.jpg\",\"id\":727538,\"type\":\"User\"},\"receiver\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"sender_comment\":{\"id\":3486414,\"content\":\"哎\",\"created_at\":\"2017-05-10 13:40\",\"voted\":false,\"voted_count\":0,\"article\":{\"document_id\":6954788,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true},\"user\":{\"id\":727538,\"name\":\"X_arcsinw\",\"avatar\":\"http://tva2.sinaimg.cn/crop.0.0.480.480.1024/e5b9045djw8ea3nvwosj3j20dc0dcaam.jpg\"}},\"receiver_comment\":{\"id\":3484647,\"content\":\"哎\",\"voted\":false,\"voted_count\":2,\"created_at\":\"2017-05-08 15:52\",\"article\":{\"document_id\":46251,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true},\"parent\":{\"id\":3484188,\"content\":\"可能是最近周末吧\",\"created_at\":\"2017-05-07 23:43\",\"voted\":true,\"voted_count\":1,\"article\":{\"document_id\":46251,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true}}}},{\"id\":3984487,\"content\":\"\",\"created_at\":1494394824,\"sended_at\":\"2017-05-10 13:40\",\"sender\":{\"name\":\"X_arcsinw\",\"avatar\":\"http://tva2.sinaimg.cn/crop.0.0.480.480.1024/e5b9045djw8ea3nvwosj3j20dc0dcaam.jpg\",\"id\":727538,\"type\":\"User\"},\"receiver\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"sender_comment\":{\"id\":3486413,\"content\":\"哎\",\"created_at\":\"2017-05-10 13:40\",\"voted\":false,\"voted_count\":1,\"article\":{\"document_id\":6954788,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true},\"user\":{\"id\":727538,\"name\":\"X_arcsinw\",\"avatar\":\"http://tva2.sinaimg.cn/crop.0.0.480.480.1024/e5b9045djw8ea3nvwosj3j20dc0dcaam.jpg\"}},\"receiver_comment\":{\"id\":3484647,\"content\":\"哎\",\"voted\":false,\"voted_count\":2,\"created_at\":\"2017-05-08 15:52\",\"article\":{\"document_id\":46251,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true},\"parent\":{\"id\":3484188,\"content\":\"可能是最近周末吧\",\"created_at\":\"2017-05-07 23:43\",\"voted\":true,\"voted_count\":1,\"article\":{\"document_id\":46251,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true}}}},{\"id\":3982130,\"content\":\"\",\"created_at\":1494229930,\"sended_at\":\"2017-05-08 15:52\",\"sender\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"receiver\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"sender_comment\":{\"id\":3484647,\"content\":\"哎\",\"created_at\":\"2017-05-08 15:52\",\"voted\":false,\"voted_count\":2,\"article\":{\"document_id\":6954788,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true},\"user\":{\"id\":720554,\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\"}},\"receiver_comment\":{\"id\":3484188,\"content\":\"可能是最近周末吧\",\"voted\":true,\"voted_count\":1,\"created_at\":\"2017-05-07 23:43\",\"article\":{\"document_id\":46251,\"title\":\"警察叔叔我捡到五块钱\",\"display_type\":1,\"image\":\"http://wx4.sinaimg.cn/large/006HyqNRly1ffcz79py00j303c03c3yj.jpg\",\"visiable\":true}}},{\"id\":3981901,\"content\":\"\",\"created_at\":1494216980,\"sended_at\":\"2017-05-08 12:16\",\"sender\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"receiver\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"sender_comment\":{\"id\":3484525,\"content\":\"x\",\"created_at\":\"2017-05-08 12:16\",\"voted\":false,\"voted_count\":0,\"article\":{\"document_id\":6954791,\"title\":\"你为什么对我还有隐瞒\",\"display_type\":1,\"image\":\"http://wx1.sinaimg.cn/large/0066bNNyly1ffdq2zfrlfj303c03cq3f.jpg\",\"visiable\":true},\"user\":{\"id\":720554,\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\"}},\"receiver_comment\":{\"id\":3484432,\"content\":\"第一\",\"voted\":false,\"voted_count\":1,\"created_at\":\"2017-05-08 10:00\",\"article\":{\"document_id\":46258,\"title\":\"你为什么对我还有隐瞒\",\"display_type\":1,\"image\":\"http://wx1.sinaimg.cn/large/0066bNNyly1ffdq2zfrlfj303c03cq3f.jpg\",\"visiable\":true}}}],\"unread_count\":0,\"timestamp\":1494216980}";
            string voteJson    = "{\"comment_vote_messages\":[{\"id\":4009868,\"content\":\"\",\"created_at\":1496036158,\"sended_at\":\"2017-05-29 13:35\",\"sender\":{\"name\":\"X_arcsinw\",\"avatar\":\"http://tva2.sinaimg.cn/crop.0.0.480.480.1024/e5b9045djw8ea3nvwosj3j20dc0dcaam.jpg\",\"id\":727538,\"type\":\"User\"},\"receiver\":{\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\",\"id\":720554,\"type\":\"User\"},\"vote\":{\"vote_id\":7284066,\"vote_content\":\"赞了你\",\"vote_at\":\"2017-05-29 13:35\"},\"voted_comment\":{\"id\":3502216,\"content\":\"???\",\"created_at\":\"2017-05-29 13:35\",\"voted\":false,\"voted_count\":1,\"article\":{\"document_id\":46804,\"title\":\"发人深省动画短片《然后》\",\"display_type\":3,\"image\":\"http://bsyimg2.cdn.krcom.cn/stream/X5I-7VR6mXTh0CWgdnI4~Xg36uQ6GDTt_40n0.jpg\",\"visiable\":true},\"user\":{\"id\":720554,\"name\":\"arcsinw\",\"avatar\":\"http://wanzao2.b0.upaiyun.com/baozouribao/59d06920034601356a05525400063398.png\"}}}],\"unread_count\":0,\"timestamp\":1496036158}";

            var commentResult = JsonHelper.Deserlialize <CommentMessageResult>(commentJson);

            foreach (var item in commentResult.CommentMessages)
            {
                CommentMessages.Add(item);
            }

            var voteResult = JsonHelper.Deserlialize <CommentMessageResult>(voteJson);

            foreach (var item in voteResult.CommentMessages)
            {
                VoteMessages.Add(item);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取评论消息
        /// </summary>
        /// <param name="count"></param>
        /// <param name="timeStamp"></param>
        /// <returns></returns>
        public async Task <IEnumerable <Message> > LoadCommentMessages(uint count, string timeStamp)
        {
            if (timeStamp.Equals(commentMessageStringBuilder.ToString()))
            {
                CommentMessages.NoMore();
                return(null);
            }

            List <Message> messages = new List <Message>();

            var result = await ApiService.Instance.GetCommentMessages(timeStamp);

            if (result != null && result.CommentMessages != null)
            {
                CommentMessages.TimeStamp = result.TimeStamp;
                commentMessageStringBuilder.Clear();
                commentMessageStringBuilder.Append(timeStamp);

                result.CommentMessages?.ForEach(x => messages.Add(x));

                return(messages);
            }
            else
            {
                CommentMessages.NoMore();
            }


            if (messages.Count == 0 && CommentMessages.Count == 0)
            {
                IsCommentMessageEmpty = true;
            }
            else
            {
                IsCommentMessageEmpty = false;
            }
            return(null);
        }