private async void OnFilterServiceSelectedFilterChanged(object sender, EventArgs e) { using (FilteredItems.SuspendChangeNotifications()) { var filter = _filterService.SelectedFilter; var items = RawItems; var result = await _filterService.FilterCollectionAsync(filter, items); FilteredItems.ReplaceRange(result); } }
#pragma warning disable AvoidAsyncVoid private async void OnFilterServiceSelectedFilterChanged(object sender, EventArgs e) #pragma warning restore AvoidAsyncVoid { using (FilteredItems.SuspendChangeNotifications()) { var filter = _filterService.SelectedFilter; var items = RawItems; var result = await _filterService.FilterCollectionAsync(filter, items); ((ICollection <TestEntity>)FilteredItems).ReplaceRange(result); } }
private async Task OnApplySchemeExecuteAsync() { Log.Debug("Applying filter scheme '{0}'", SelectedFilterScheme); //build filtered collection only if current mode is Collection if (Mode == FilterBuilderMode.Collection) { FilteringFunc = null; await _filterService.FilterCollectionAsync(SelectedFilterScheme, RawCollection, FilteredCollection); } else { FilteringFunc = SelectedFilterScheme.CalculateResult; } }
public static async Task <IEnumerable <TItem> > FilterCollectionAsync <TItem>(this IFilterService filterService, FilterScheme filter, IEnumerable <TItem> rawCollection) { var filteredCollection = new List <TItem>(); if (rawCollection is null) { return(filteredCollection); } if (filter is null) { filteredCollection.AddRange(rawCollection); return(filteredCollection); } await filterService.FilterCollectionAsync(filter, rawCollection, filteredCollection); return(filteredCollection); }
public static Task <IEnumerable <TItem> > FilterCollectionWithCurrentFilterAsync <TItem>(this IFilterService filterService, IEnumerable <TItem> rawCollection) { return(filterService.FilterCollectionAsync(filterService.SelectedFilter, rawCollection)); }