Пример #1
0
 public void GetServiceKbArticleSuccess(KbArticlesModel model)
 {
     handler.Post(() =>
     {
         if (swipeRefreshLayout.Refreshing)
         {
             swipeRefreshLayout.Refreshing = false;
         }
         kbarticle = model;
         if (swipeRefreshLayout.Refreshing)
         {
             swipeRefreshLayout.Refreshing = false;
         }
         var content = HtmlUtils.ReadHtml(Assets);
         var body    = HtmlUtils.ReplaceHtml(model.Body).Trim('"');
         txtBody.LoadDataWithBaseURL("file:///android_asset/", content.Replace("#title#", model.Title).Replace("#body#", body), "text/html", "utf-8", null);
     });
 }
Пример #2
0
        public void GetClientKbArticleSuccess(KbArticlesModel model)
        {
            if (model != null)
            {
                kbarticle     = model;
                toolbar.Title = model.Title;
                if (model.Author != null)
                {
                    toolbar.Title += " - " + HtmlUtils.GetHtml(model.Author).ToString();
                }
                txtPostdate.Text = "发布于:" + DateTimeUtils.CommonTime(kbarticle.DateAdded);

                if (kbarticle.DiggCount > 0)
                {
                    txtDigg.Text = kbarticle.DiggCount.ToString();
                }
                if (kbarticle.ViewCount > 0)
                {
                    txtRead.Text = kbarticle.ViewCount.ToString();
                }
                (txtComments.Parent as FrameLayout).Click += delegate
                {
                    Toast.MakeText(this, "很抱歉,暂未开放此功能。", ToastLength.Short).Show();
                };
                (txtBookmark.Parent as FrameLayout).Click += delegate
                {
                    var linkurl = "http://kb.cnblogs.com/page/" + kbarticle.Id + "/";
                    var title   = kbarticle.Title + "_知识库_博客园";
                    BookmarkAddActivity.Start(this, linkurl, title, true);
                };

                if (kbarticle.Body == null || kbarticle.Body == "")
                {
                    OnRefresh();
                }
                else
                {
                    GetServiceKbArticleSuccess(model);
                }
            }
        }