示例#1
0
        /* load news and add them into latestNews list */
        public async Task <bool> loadNews(DateTime day1, bool isOnlineDownload = false)
        {
            DateTime day2 = day1.AddDays(-defaultDaysOfNews);

            for (DateTime day = day1; day2.CompareTo(day) <= 0; day = day.AddDays(-1))
            {
                OneDayNews oneDayNews = new OneDayNews(day);
                if (await oneDayNews.updateNews(isOnlineDownload) == false)
                {
                    return(false);
                }
                latestNews.Add(oneDayNews);
            }
            return(true);
        }
示例#2
0
        /* update all the news */
        public async Task <bool> updateNews(DateTime day1)
        {
            DateTime day2 = day1.AddDays(-defaultDaysOfNews);

            latestNews = new List <OneDayNews>();
            for (DateTime day = day1; day2.CompareTo(day) <= 0; day = day.AddDays(-1))
            {
                OneDayNews oneDayNews = new OneDayNews(day);
                if (await oneDayNews.updateNews() == false)
                {
                    return(false);
                }
                latestNews.Add(oneDayNews);
            }
            return(true);
        }