Пример #1
0
 public void OnNavigatedTo(INavigationParameters parameters)
 {
     for (int i = 0; i < 10; i++)
     {
         ProductItemList.Add(new ProductItem
         {
             id          = i,
             Name        = $"產品名稱{i}",
             Description = $"規格說明{i}"
         });
     }
 }
Пример #2
0
        private async Task ItemsTresholdReached()
        {
            if (IsBusy)
            {
                return;
            }
            if (CurrentPage >= TotalPages)
            {
                return;
            }
            if (ProductItemList == null || ProductItemList.Count == 0)
            {
                return;
            }
            IsBusy = true;
            try
            {
                CurrentPage++;
                var items = await LoadProductList(SearchText, CurrentPage);

                var previousLastItem = ProductItemList.Last();
                foreach (var item in items.Products)
                {
                    ProductItemList.Add(item);
                }
                Debug.WriteLine($"{items.Products.Count()} {ProductItemList.Count} ");
                if (items.Products.Count() == 0)
                {
                    ItemTreshold = -1;
                    return;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }