private async Task <IList <NewsItem> > LoadMoreItemsAsync()
        {
            BusyCount++;

            IsError = false;

            var items    = new List <NewsItem>();
            var lastItem = FeedItems.LastOrDefault();
            var dateTime = lastItem == null ? DateTimeOffset.Now : DateTimeOffset.Parse(lastItem.DatePublish);

            try
            {
                var response = await _feedNewsProvider.LoadNewsAsync(dateTime, Category.Code);

                items.AddRange(response);
            }
            catch (Exception ex)
            {
                //var response = await _feedNewsProvider.LoadFeedNewsAsync(FeedItems.LastOrDefault(), Category.Code, DataAccess.RequestAccessMode.Cache);
                //if (response != null)
                //{
                //    items.AddRange(response);
                //}

                //IsError = true;
            }

            //foreach (var item in items)
            //{
            //    item.IsReaded = DataProviders.DataBaseProvider.IsItemExists<FeedItem>(item.Id);
            //}

            BusyCount--;
            return(items);
        }
Esempio n. 2
0
        private async Task <IList <FeedItem> > LoadMoreItemsAsync()
        {
            BusyCount++;
            var items = new List <FeedItem>();

            IsError = false;

            try
            {
                var response = await _authorsProvider.LoadAuthorsFeedAsync(FeedItems.LastOrDefault(), this.Category.Code);

                items.AddRange(response);
            }
            catch (Exception)
            {
                //IsError = true;

                var response = await _authorsProvider.LoadAuthorsFeedAsync(FeedItems.LastOrDefault(), this.Category.Code);

                if (response != null)
                {
                    items.AddRange(response);
                }
            }

            //foreach (var item in items)
            //{
            //    item.IsReaded = DataProviders.DataBaseProvider.IsItemExists<FeedItem>(item.Id);
            //}

            base.BusyCount--;
            return(items);
        }