Beispiel #1
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            if (indexes.Length < 2)
            {
                return;
            }

            var index1 = indexes[0];
            var index2 = indexes[1];

            if (index1 > -1 && index2 < observableCollection.Count && index1 <= index2)
            {
                var newItems = new List <CollectionViewGalleryTestItem>();

                for (int n = 0; n < 4; n++)
                {
                    newItems.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                   $"Added", "coffee.png", n));
                }

                if (_withIndex)
                {
                    observableCollection.TestReplaceWithListAndIndex(index1, index2 - index1 + 1, newItems);
                }
                else
                {
                    observableCollection.TestReplaceWithList(index1, index2 - index1 + 1, newItems);
                }
            }
        }
Beispiel #2
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            if (indexes.Length < 3)
            {
                return;
            }

            var startIndex       = indexes[0];
            var endIndex         = indexes[1];
            var destinationIndex = indexes[2];

            var count = observableCollection.Count;

            // -1 < startIndex < endIndex < count
            if (startIndex < 0 || endIndex >= count || endIndex <= startIndex)
            {
                return;
            }

            var itemsToMove = endIndex - startIndex;

            // Can't move the items past the end of the list
            if (destinationIndex > (count - itemsToMove))
            {
                return;
            }

            observableCollection.TestMoveWithList(startIndex, (endIndex - startIndex) + 1, destinationIndex);
        }
Beispiel #3
0
        void GenerateMultiTestObservableCollection()
        {
            if (int.TryParse(_entry.Text, out int count))
            {
                var items = new MultiTestObservableCollection <CollectionViewGalleryTestItem>();

                for (int n = 0; n < count; n++)
                {
                    items.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                $"{_images[n % _images.Length]}, {n}", _images[n % _images.Length], n));
                }

                _cv.ItemsSource = items;
            }
        }
Beispiel #4
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            if (indexes.Length < 2)
            {
                return;
            }

            var index1 = indexes[0];
            var index2 = indexes[1];

            if (index1 > -1 && index2 < observableCollection.Count && index1 <= index2)
            {
                if (_withIndex)
                {
                    observableCollection.TestRemoveWithListAndIndex(index1, (index2 - index1) + 1);
                }
                else
                {
                    observableCollection.TestRemoveWithList(index1, (index2 - index1) + 1);
                }
            }
        }
Beispiel #5
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            var index1 = indexes[0];

            if (index1 > -1 && index1 < observableCollection.Count)
            {
                var newItems = new List <CollectionViewGalleryTestItem>();

                for (int n = 0; n < 4; n++)
                {
                    newItems.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                   $"Added", "coffee.png", n));
                }

                if (_withIndex)
                {
                    observableCollection.TestAddWithListAndIndex(newItems, index1);
                }
                else
                {
                    observableCollection.TestAddWithList(newItems, index1);
                }
            }
        }
Beispiel #6
0
 protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
 {
     observableCollection.TestReset();
 }
 protected abstract void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes);