Пример #1
0
 public ThreadViewModel(BuThread thread)
 {
     Subject     = thread.subject = BuAPI.parseHTML(HttpUtility.UrlDecode(thread.subject));
     Author      = thread.author = HttpUtility.UrlDecode(thread.author);
     Time        = BuAPI.DateTimeConvertTime(thread.dateline).ToString("MM-dd HH:mm");
     PostItems   = new ObservableCollection <PostViewModel>();
     Replies     = "回复:" + thread.replies;
     this.thread = thread;
 }
Пример #2
0
        public PostViewModel(BuPost post, uint floorno)
        {
            //填写楼层信息
            if (floorno == 1)
            {
                FloorNo = "楼主";
            }
            else
            {
                FloorNo = floorno.ToString() + "楼";
            }

            QuoteItems = new ObservableCollection <QuoteViewModel>();
            //加载图片
            if (post.attachment != null)
            {
                ImageSrc = BuAPI.GetImageSrc(HttpUtility.UrlDecode(post.attachment));
            }

            string message = HttpUtility.UrlDecode(post.message);

            List <BuQuote> quotes = BuAPI.parseQuotes(ref message);

            foreach (var quote in quotes)
            {
                QuoteItems.Add(new QuoteViewModel(quote.author + "  " + quote.time + "\r\n" + quote.content.Trim()));
            }

            DateTime dt = BuAPI.DateTimeConvertTime(post.dateline);

            //格式化时间”年-月-日 小时:分钟“
            string strtime = dt.ToString("yyyy-M-d HH:mm");

            Message       = (BuAPI.parseHTML(message)).Trim();
            AddInfo       = HttpUtility.UrlDecode(post.author) + "  " + strtime;
            post.dateline = strtime;
            post.message  = Message;
            post.author   = HttpUtility.UrlDecode(post.author);
            _post         = post;
        }