Пример #1
0
        private async Task <bool> CanLoadMoreAsync()
        {
            if (IsItemsLoading)
            {
                return(false);
            }
            IsItemsLoading = true;

            if (Category.Items?.Any() != true)
            {
                IsItemsLoading = false;
                return(false);
            }

            if (VisibleState == States?[0])
            {
                var count = await FirebaseService.GetItemsCountAsync(Category);

                if (Category.Items.Count >= count)
                {
                    IsItemsLoading = false;
                    return(false);
                }
            }
            else if (VisibleState?.StateName == "SearchResults")
            {
                var count = await FirebaseService.GetItemsCountAsync(SearchItem);

                if (Category.Items.Count >= count)
                {
                    IsItemsLoading = false;
                    return(false);
                }
            }
            else if (VisibleState.StateID != null)
            {
                var count = await FirebaseService.GetItemsCountAsync(VisibleState);

                if (Category.Items.Count >= count)
                {
                    IsItemsLoading = false;
                    return(false);
                }
            }

            IsItemsLoading = false;
            return(true);
        }