Esempio n. 1
0
        public ViewModel7357()
        {
            for (var i = 0; i < 50; i++)
            {
                var model = new Model7357 {
                    Text = "Item " + i
                };

                if (i == 49)
                {
                    model.BackgroundColor = Colors.Pink;
                }

                ItemsSource.Add(model);
            }
        }
Esempio n. 2
0
        async void CollectionView_RemainingItemsThresholdReached(object sender, System.EventArgs e)
        {
            if (_isUpdatingSource)
            {
                return;
            }

            await _semaphoreSlim.WaitAsync();

            try
            {
                _isUpdatingSource = true;

                var itemsSource = ((sender as CollectionView).ItemsSource as ObservableCollection <Model7357>);
                var count       = itemsSource.Count;

                if (count == 100)
                {
                    return;
                }

                for (var i = count; i < count + 50; i++)
                {
                    var model = new Model7357 {
                        Text = "Item " + i
                    };

                    if (i == 99)
                    {
                        model.BackgroundColor = Colors.Pink;
                    }

                    itemsSource.Add(model);
                }
            }
            finally
            {
                _semaphoreSlim.Release();
                _isUpdatingSource = false;
            }
        }