public MainPageViewModel(INavigationService navigationService, IPokeApi pokeApi, IPageDialogService pageDialogService) : base(navigationService) { Title = "Main Page"; _pokeApi = pokeApi; _pageDialogService = pageDialogService; NavegarCommand = new DelegateCommand <Pokemon>(async(pokemon) => await NavegarCommandExecute(pokemon)); GaleriaCommand = new DelegateCommand <Pokemon>(async(pokemon) => await GaleriaCommandExecute(pokemon)); RefreshCommand = new DelegateCommand(async() => await RefreshCommandExecute()); Pokemons = new InfiniteScrollCollection <Pokemon> { OnLoadMore = async() => { IsBusy = true; var items = new List <Pokemon>(); PokemonList = await _pokeApi.ObterListaPokemons(offset : OffSet); if (PokemonList != null) { foreach (var poke in PokemonList.results) { var pokemon = await _pokeApi.ObterPokemon(poke.url); if (pokemon != null) { items.Add(pokemon); } } offset += 20; } IsBusy = false; return(items); }, OnCanLoadMore = () => { if (!string.IsNullOrEmpty(PokemonList.next)) { return(true); } return(false); } }; Pokemons.LoadMoreAsync(); }
public PokedexViewModel(IPokeApi repositoryService) { }
public PokemonRepository(ILogger <PokemonRepository> logger, IPokeApi api) { _logger = logger; _api = api; _escapeCleanerRegex = new Regex(@"[\n\t\f\a]", RegexOptions.Compiled); }
public PokeApiAdapter(IPokeApi pokeApi) { this.pokeApi = pokeApi ?? throw new ArgumentNullException(nameof(pokeApi)); }
public DetalhePokemonViewModel(INavigationService navigationService, IPokeApi pokeApi, IPageDialogService pageDialogService) : base(navigationService) { }