public override void WillDisplayCell(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath)
 {
     if ((indexPath.Row >= (ItemsSource.Count() - FromBottomCellStartLoadingIndex)) && MoreCommand != null && MoreCommand.CanExecute(null))
     {
         MoreCommand.Execute(null);
     }
 }
        public MainPageViewModel(IWebApi webApi)
        {
            _webApi = webApi;

            MoreCommand.Subscribe(async _ =>
            {
                foreach (var book in await GetData())
                {
                    Books.Add(book);
                }
            });

            PrevCommand.Subscribe(_ =>
            {
                if (Position.Value > 0)
                {
                    Position.Value--;
                }
            });

            NextCommand.Subscribe(_ =>
            {
                if (Position.Value < Books.Count - 1)
                {
                    Position.Value++;
                }
            });
        }
Beispiel #3
0
        private async void InvokeMore()
        {
            if (!isBusy)
            {
                isBusy = true;
                if (MoreContent != null)
                {
                    MoreContent(this, EventArgs.Empty);
                }

                if (MoreCommand != null && MoreCommand.CanExecute(default(object)))
                {
                    await MoreCommand.Execute(default(object));
                }
                isBusy = false;
            }
        }