protected async override void OnInitialized() { FilteredDogs = new List <Image>(); DebounceTimer = new Timer(500); DebounceTimer.Elapsed += OnUserFinish; DebounceTimer.AutoReset = false; await FilteredDogsChanged.InvokeAsync(_initialDogs); }
private async void OnUserFinish(Object source, ElapsedEventArgs e) { if (string.IsNullOrEmpty(NameSearchString) && string.IsNullOrEmpty(BreedSearchString)) { await FilteredDogsChanged.InvokeAsync(_initialDogs); return; } FilteredDogs = Dogs.Where(FilterName) .Where(FilterBreed).ToList(); if (FilteredDogs == null) { await FilteredDogsChanged.InvokeAsync(_initialDogs); } else { await FilteredDogsChanged.InvokeAsync(FilteredDogs); } }