Beispiel #1
0
        /// <summary>
        /// Creates an <see cref="AsyncObservableCollectionView{T}"/> and binds the repository changes to the collection
        /// </summary>
        public static async Task <AsyncObservableCollectionView <T> > ToAsyncObservableCollectionView <T, TKey>(this ICRUDRepository <T, TKey> repo, FilterHandler <T> filter)
            where T : IUniqueObject <TKey>
        {
            var items = await repo.GetItems();

            var collection = AsyncObservableCollectionView <T> .Create(filter, items);

            collection.BindToRepositoryChanges(repo);
            return(collection);
        }
Beispiel #2
0
        /// <inheritdoc />
        protected override async Task OnInitialization()
        {
            await base.OnInitialization();

            ExecuteOnUIContext(() =>
            {
                SearchResults = AsyncObservableCollectionView <SearchItem> .Create((a, b) => true);
                SearchResults.CollectionView.SortDescriptions.Add(new SortDescription(nameof(SearchItem.Title), ListSortDirection.Ascending));
            });
            AttachNavigationHandler(_applicationSearchService.GetIndexedItems());
            _applicationSearchService.ItemsIndexed += (sender, args) => AttachNavigationHandler(args);
        }
Beispiel #3
0
 /// <summary>
 /// Creates an <see cref="AsyncObservableCollectionView{T}"/> from a collection.
 /// </summary>
 public static async Task <AsyncObservableCollectionView <T> > ToAsyncObservableCollectionView <T>(this Task <IEnumerable <T> > collection, FilterHandler <T> filterPredicate)
 {
     return(AsyncObservableCollectionView <T> .Create(filterPredicate, await collection));
 }
Beispiel #4
0
 /// <summary>
 /// Creates an <see cref="AsyncObservableCollectionView{T}"/> from a collection.
 /// </summary>
 public static AsyncObservableCollectionView <T> ToAsyncObservableCollectionView <T>(this IEnumerable <T> collection, FilterHandler <T> filterPredicate)
 {
     return(AsyncObservableCollectionView <T> .Create(filterPredicate, collection));
 }