async Task ConcertsTresholdReached() { if (IsBusy) { return; } IsBusy = true; try { pageNumber++; if (pageNumber > pagesCount) { ConcertTreshold = -1; return; } var concerts = await concertService.GetAllConcerts(pageNumber); Concerts.AddRange(concerts); FilteredConcerts.AddRange(concerts); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async Task ExecuteLoadConcertsCommand() { if (IsBusy) { return; } IsBusy = true; try { var concertsCount = await concertService.ConcertsCount(); pagesCount = (int)Math.Ceiling((double)concertsCount / AppConstants.PAGE_SIZE); ConcertTreshold = 4; Concerts.Clear(); var concerts = await concertService.GetAllConcerts(); Concerts.AddRange(concerts); FilteredConcerts.AddRange(concerts); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }