Пример #1
0
        public S1Post GetData()
        {
            var data = raw.Parse<ThreadVariables>();
            if (S1Resource.FormHashUpdater != null)
                S1Resource.FormHashUpdater.UpdateFormHash(data.Formhash);

            var thread = new S1Post();
            thread.Title = S1Resource.HttpUtility.HtmlDecode(data.Thread.Subject);
            thread.TotalPage = (data.Thread.Replies + DZParserFactory.PostsPerPage)/DZParserFactory.PostsPerPage;
            thread.Items = new List<S1PostItem>();
            thread.ReplyLink = string.Format("?module=sendreply&replysubmit=yes&fid={0}&tid={1}", data.Thread.Fid, data.Thread.Tid);

            foreach (var post in data.Postlist)
            {
                var item = new S1PostItem();
                if (thread.CurrentPage == 0)
                    thread.CurrentPage = post.Number/DZParserFactory.PostsPerPage + 1;
                item.No = post.Number;
                item.Author = S1Resource.HttpUtility.HtmlDecode(post.Author);
                item.Date = S1Resource.HttpUtility.HtmlDecode(post.Dateline);

                BuildContent(post, item);
                thread.Items.Add(item);
            }
            return thread;
        }
Пример #2
0
        public override async Task RefreshData()
        {
            ThePost = null;
            if (null == _tid)
            {
                return;
            }
            Util.Indicator.SetLoading();
            try
            {
                var temp = await _dataService.GetThreadDataAsync(_tid, CurrentPage);

                if (temp.CurrentPage == CurrentPage)
                {
                    ThePost   = temp;
                    TotalPage = ThePost.TotalPage;
                    Title     = ThePost.Title;
                    NotifyOfPropertyChange(() => CanFirstPage);
                    NotifyOfPropertyChange(() => CanPrePage);
                    NotifyOfPropertyChange(() => CanNextPage);
                    NotifyOfPropertyChange(() => CanLastPage);
                }
                Util.Indicator.SetBusy(false);
            }
            catch (Exception e)
            {
                if (!HandleUserException(e))
                {
                    Util.Indicator.SetError(e);
                    NotifyMessage = Util.ErrorMsg.GetExceptionMessage(e);
                }
            }
        }
Пример #3
0
        public S1Post GetData()
        {
            var data = raw.Parse <ThreadVariables>();

            if (S1Resource.FormHashUpdater != null)
            {
                S1Resource.FormHashUpdater.UpdateFormHash(data.Formhash);
            }

            var thread = new S1Post();

            thread.Title     = S1Resource.HttpUtility.HtmlDecode(data.Thread.Subject);
            thread.TotalPage = (data.Thread.Replies + DZParserFactory.PostsPerPage) / DZParserFactory.PostsPerPage;
            thread.Items     = new List <S1PostItem>();
            thread.ReplyLink = string.Format("?module=sendreply&replysubmit=yes&fid={0}&tid={1}", data.Thread.Fid, data.Thread.Tid);

            foreach (var post in data.Postlist)
            {
                var item = new S1PostItem();
                if (thread.CurrentPage == 0)
                {
                    thread.CurrentPage = post.Number / DZParserFactory.PostsPerPage + 1;
                }
                item.No     = post.Number;
                item.Author = S1Resource.HttpUtility.HtmlDecode(post.Author);
                item.Date   = S1Resource.HttpUtility.HtmlDecode(post.Dateline);

                BuildContent(post, item);
                thread.Items.Add(item);
            }
            return(thread);
        }
Пример #4
0
 public override async Task RefreshData()
 {
     ThePost = null;
     if (null == _tid) return;
     Util.Indicator.SetLoading();
     try
     {
         var temp = await _dataService.GetThreadDataAsync(_tid, CurrentPage);
         if (temp.CurrentPage == CurrentPage)
         {
             ThePost = temp;
             TotalPage = ThePost.TotalPage;
             Title = ThePost.Title;
             NotifyOfPropertyChange(() => CanFirstPage);
             NotifyOfPropertyChange(() => CanPrePage);
             NotifyOfPropertyChange(() => CanNextPage);
             NotifyOfPropertyChange(() => CanLastPage);
         }
         Util.Indicator.SetBusy(false);
     }
     catch (Exception e)
     {
         if (!HandleUserException(e))
         {
             Util.Indicator.SetError(e);
             NotifyMessage = Util.ErrorMsg.GetExceptionMessage(e);
         }
     }
 }