示例#1
0
        private void UpdatePackageList(LoadResult r)
        {
            // remove the loading status indicator if it's in the list
            if (_items[_items.Count - 1] == _loadingStatusIndicator)
            {
                _items.RemoveAt(_items.Count - 1);
            }

            // add newly loaded items
            foreach (var obj in r.Items)
            {
                _items.Add(obj);
            }

            // update loading status indicator
            if (!r.HasMoreItems)
            {
                if (_items.Count == 0)
                {
                    _loadingStatusIndicator.Status = LoadingStatus.NoItemsFound;
                }
                else
                {
                    _loadingStatusIndicator.Status = LoadingStatus.NoMoreItems;
                }
            }
            else
            {
                _startIndex = r.NextStartIndex;
                _loadingStatusIndicator.Status = LoadingStatus.Ready;
            }

            if (_loadingStatusIndicator.Status != LoadingStatus.NoMoreItems)
            {
                _items.Add(_loadingStatusIndicator);
            }
        }
        private void UpdatePackageList(LoadResult r)
        {
            // remove the loading status indicator if it's in the list
            if (_items[_items.Count - 1] == _loadingStatusIndicator)
            {
                _items.RemoveAt(_items.Count - 1);
            }

            // add newly loaded items
            foreach (var obj in r.Items)
            {
                _items.Add(obj);
            }

            // update loading status indicator
            if (!r.HasMoreItems)
            {
                if (_items.Count == 0)
                {
                    _loadingStatusIndicator.Status = LoadingStatus.NoItemsFound;
                }
                else
                {
                    _loadingStatusIndicator.Status = LoadingStatus.NoMoreItems;
                }
            }
            else
            {
                _startIndex = r.NextStartIndex;
                _loadingStatusIndicator.Status = LoadingStatus.Ready;
            }

            if (_loadingStatusIndicator.Status != LoadingStatus.NoMoreItems)
            {
                _items.Add(_loadingStatusIndicator);
            }
        }