コード例 #1
0
        private async Task <IEnumerable <IModel> > GetData(uint startIndex, int page)
        {
            if (IsLoading)
            {
                return(new List <IModel>());
            }
            if (currentPage > 5)
            {
                Pins.NoMore();
                NoMoreVisibility = Visibility.Visible;
                return(new List <IModel>());
            }

            IsLoading = true;
            try
            {
                var home = await HomeService.GetPagingHomeAsync(currentPage ++);

                if (home.Recommends.Count > 0)
                {
                    Pins.HasMore();
                }
                else
                {
                    Pins.NoMore();
                    NoMoreVisibility = Visibility.Visible;
                }

                if (home.Explores?.Count > 0 && !(Explores?.Count > 0))
                {
                    Explores = new ObservableCollection <Explore>(home.Explores);
                }

                return(home.Recommends);
            }
            catch
            {
            }
            finally
            {
                IsLoading = false;
            }

            return(null);
        }