Exemplo n.º 1
0
        private async Task LoadRecentItems()
        {
            var response = await _cacheService.GetRecentItemsFromCache();

            if (RecentItems.IsNullOrEmpty())
            {
                RecentItems = new ObservableCollection <ReaderItem>(response.ReaderItems);
                return;
            }

            foreach (var item in response.ReaderItems)
            {
                var existingItem = RecentItems.FirstOrDefault(x => x.Id == item.Id);
                if (existingItem != null)
                {
                    item.CopyItem(existingItem);
                }
                else
                {
                    RecentItems.Add(item);
                }
            }
        }