示例#1
0
        public async Task LoadAsync(int take = 10)
        {
            if (_collection == null)
            {
                throw new NullReferenceException("The collection has not been initialized.");
            }

            IsLoading = true;

            // Skip the items that are already loaded/being loaded and take the defined amount
            var itemsToLoad = _items
                              .Skip(_loadedPreCount)
                              .Take(take)
                              .ToArray();

            // Increment the pre count
            _loadedPreCount += itemsToLoad.Length;

            // Update the assets and then finally add to the loaded list
            await itemsToLoad.UpdateAssets(_client);

            Loaded.AddRange(itemsToLoad);

            IsLoading = false;
        }