Пример #1
0
        public bool SetBookList(string html)
        {
            if (!string.IsNullOrEmpty(html))
            {
                ObservableCollection <BookEntity>[] arraryList = AnalysisSoduService.GetHomePageBookList(html);
                if (arraryList == null)
                {
                    return(false);
                }
                else
                {
                    if (arraryList[1] == null)
                    {
                        return(false);
                    }
                    this.RecommendBookList.Clear();
                    foreach (var item in arraryList[1])
                    {
                        this.RecommendBookList.Add(item);
                    }

                    this.HotBookList.Clear();
                    foreach (var item in arraryList[2])
                    {
                        this.HotBookList.Add(item);
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public bool SetBookList(string html, int pageIndex)
        {
            if (!string.IsNullOrEmpty(html))
            {
                List <BookEntity> arrary = AnalysisSoduService.GetBookUpdateChapterList(html);
                if (arrary == null)
                {
                    return(false);
                }
                else
                {
                    if (this.ChapterList != null)
                    {
                        this.ChapterList.Clear();
                    }
                    else
                    {
                        this.ChapterList = new ObservableCollection <BookEntity>();
                    }
                    this.PageIndex = pageIndex;

                    foreach (var item in arrary)
                    {
                        item.BookName = this.ContentTitle;
                        item.BookID   = this.CurrentEntity.BookID;
                        this.ChapterList.Add(item);
                    }
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        public bool SetBookList(string html, int pageIndex)
        {
            if (!string.IsNullOrEmpty(html))
            {
                var arrary = AnalysisSoduService.GetRankListFromHtml(html);
                if (arrary == null)
                {
                    return(false);
                }
                else
                {
                    if (this.BookList != null)
                    {
                        this.BookList.Clear();
                    }
                    this.PageIndex = pageIndex;
                    foreach (var item in arrary)
                    {
                        this.BookList.Add(item);
                    }
                    return(true);
                }
            }

            return(false);
        }
Пример #4
0
        public void SetBookList(string html)
        {
            if (!string.IsNullOrEmpty(html))
            {
                var list = AnalysisSoduService.GetBookShelftListFromHtml(html);
                if (list == null)
                {
                    this.IsShow = true;
                }
                else
                {
                    this.ShelfBookList?.Clear();
                    this.IsShow = false;

                    if (list.Count > 0)
                    {
                        var temp = list.OrderByDescending(p => DateTime.Parse(p.UpdateTime)).ToList();
                        foreach (var item in temp)
                        {
                            var entity = DBBookShelf.GetBook(AppDataPath.GetBookShelfDBPath(), item);
                            if (!string.IsNullOrEmpty(entity?.LastReadChapterName))
                            {
                                item.LastReadChapterName = entity.LastReadChapterName;
                                var sim = LevenshteinDistancePercent(item.LastReadChapterName, item.NewestChapterName);
                                if (sim)
                                {
                                    item.UnReadCountData = "";
                                }
                                else
                                {
                                    item.UnReadCountData = "(有更新)";
                                }
                            }
                            else
                            {
                                item.UnReadCountData     = "(有更新)";
                                item.LastReadChapterName = item.NewestChapterName;
                            }
                            ShelfBookList.Add(item);
                        }
                        DBBookShelf.ClearBooks(AppDataPath.GetBookShelfDBPath());
                        DBBookShelf.InsertOrUpdateBooks(AppDataPath.GetBookShelfDBPath(), ShelfBookList.ToList());
                    }
                }
                ToastHeplper.ShowMessage("个人书架已更新");
            }
        }
Пример #5
0
        public bool SetBookList(string html, int pageIndex)
        {
            if (!string.IsNullOrEmpty(html))
            {
                ObservableCollection <BookEntity> arrary = AnalysisSoduService.GetRankListFromHtml(html);
                if (arrary == null)
                {
                    return(false);
                }
                else
                {
                    this.BookList?.Clear();

                    foreach (var item in arrary)
                    {
                        BookList.Add(item);
                    }
                    this.PageIndex = pageIndex;
                    return(true);
                }
            }
            return(false);
        }
Пример #6
0
        public bool SetBookList(string html)
        {
            bool result = false;

            this.SearchResultList.Clear();
            try
            {
                if (!string.IsNullOrEmpty(html))
                {
                    ObservableCollection <BookEntity> arraryList = AnalysisSoduService.GetRankListFromHtml(html);
                    if (arraryList == null)
                    {
                        return(false);
                    }
                    else
                    {
                        if (arraryList.Count > 0)
                        {
                            foreach (var item in arraryList)
                            {
                                this.SearchResultList.Add(item);
                            }
                        }
                        result = true;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }