Esempio n. 1
0
 protected async override void OnInitialized()
 {
     FilteredDogs            = new List <Image>();
     DebounceTimer           = new Timer(500);
     DebounceTimer.Elapsed  += OnUserFinish;
     DebounceTimer.AutoReset = false;
     await FilteredDogsChanged.InvokeAsync(_initialDogs);
 }
Esempio n. 2
0
        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);
            }
        }