Beispiel #1
0
 public ForumViewModel(BuForum forum)
 {
     Name        = forum.name = BuAPI.parseHTML(HttpUtility.UrlDecode(forum.name));
     Description = BuAPI.parseHTML(HttpUtility.UrlDecode(forum.description));
     Moderator   = HttpUtility.UrlDecode(forum.moderator);
     Onlines     = forum.onlines;
     this.forum  = forum;
     ThreadItems = new ObservableCollection <ThreadViewModel>();
 }
Beispiel #2
0
 public ThreadViewModel(BuLatestThread bt)
 {
     Subject           = bt.pname = BuAPI.parseHTML(HttpUtility.UrlDecode(bt.pname));
     Author            = bt.author = HttpUtility.UrlDecode(bt.author);
     ForumName         = bt.fname = BuAPI.parseHTML(HttpUtility.UrlDecode(bt.fname));
     Replies           = "回复:" + bt.tid_sum;
     this.latestthread = bt;
     PostItems         = new ObservableCollection <PostViewModel>();
 }
Beispiel #3
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;
 }
Beispiel #4
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;
        }