コード例 #1
0
 public async Task GetComment(int slug, int offset)
 {
     try
     {
         var comments = JsonConvert.DeserializeObject <List <ArticleCommentModel> >(await OkHttpUtils.Instance.GetAsyn(ApiUtils.GetArticleComment(slug, limit, offset)));
         commentView.GetCommentSuccess(comments);
     }
     catch (Exception ex)
     {
         commentView.GetCommentFail(ex.Message);
     }
 }
コード例 #2
0
        public async Task GetComment(AccessToken token, string blogApp, int id, int pageIndex = 1)
        {
            try
            {
                var result = await OkHttpUtils.Instance(token).GetAsyn(string.Format(ApiUtils.ArticleComment, blogApp, id, pageIndex, pageSize));

                if (result.IsError)
                {
                    commentView.GetCommentFail(result.Message);
                }
                else
                {
                    var comments = JsonConvert.DeserializeObject <List <ArticleCommentModel> >(result.Message);
                    commentView.GetCommentSuccess(comments);
                }
            }
            catch (Exception ex)
            {
                commentView.GetCommentFail(ex.Message);
            }
        }