Пример #1
0
        /// <summary>
        /// 刷新赞消息
        /// </summary>
        public async Task RefreshVoteMessagesAsync()
        {
            IsActive = true;
            voteMessageTimeStamp.Clear();
            voteMessageTimeStamp.Append("0");
            await VoteMessages.ClearAndReloadAsync();

            IsActive = false;
        }
Пример #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);
            }
        }
Пример #3
0
        /// <summary>
        /// 获取点赞消息
        /// </summary>
        /// <param name="count"></param>
        /// <param name="timeStamp"></param>
        /// <returns></returns>
        public async Task <IEnumerable <Message> > LoadVoteMessage(uint count, string timeStamp)
        {
            List <Message> messages = new List <Message>();

            if (timeStamp.Equals(voteMessageTimeStamp.ToString()))
            {
                VoteMessages.NoMore();
                return(messages);
            }

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

            if (result != null && result.CommentVoteMessages != null)
            {
                VoteMessages.TimeStamp = result.TimeStamp;

                voteMessageTimeStamp.Clear();
                voteMessageTimeStamp.Append(result.TimeStamp);

                foreach (var item in result.CommentVoteMessages)
                {
                    messages.Add(item);
                }
            }

            if (messages.Count == 0 && VoteMessages.Count == 0)
            {
                IsVoteMessageEmpty = true;
            }
            else
            {
                IsVoteMessageEmpty = false;
            }

            return(messages);
        }