Beispiel #1
0
        public async Task Update(IComplianceRecordsFilter filter)
        {
            _items.ClearSources();
            var dataItems = await _dataService.GetComplianceRecordsAsync(filter);

            _items.AddSource(dataItems);
        }
        private IEnumerable CreateEvents()
        {
            var result = new WrappingCollection
            {
                FactoryMethod = o => new EventViewModel((IEvent)o)
            };

            result.AddSource(_dataService.Events);

            var view = result.AsView();

            view.SortDescriptions.Add(new SortDescription("Time", ListSortDirection.Descending));

            return(view);
        }
        WhenCollectionIsCreatedWithRangeAndSourceIsUpdatedWithAddRange_ThenSingleNotificationIsRaisedWithAllWrappers
            ()
        {
            var source        = new RangeObservableCollection <object>();
            var items         = new[] { new object(), new object() };
            var numberOfTimes = 0;

            var collection = new WrappingCollection(isBulk: true)
            {
                FactoryMethod = o => o
            };

            collection.AddSource(source);
            collection.CollectionChanged += (sender, args) =>
            {
                args.NewItems.Should().BeEquivalentTo(items);
                numberOfTimes++;
                numberOfTimes.Should().Be(1);
            };
            source.AddRange(items);
        }
        private IEnumerable CreateEvents()
        {
            var result = new WrappingCollection
            {
                FactoryMethod = o => new EventViewModel((IEvent) o)
            };
            result.AddSource(_dataService.Events);

            var view = result.AsView();
            view.SortDescriptions.Add(new SortDescription("Time", ListSortDirection.Descending));

            return view;
        }