Example #1
0
        private async Task BuscarPokemos(string param = "1", bool show = true)
        {
            try
            {
                if (show)
                {
                    Pokemon pokemon = (Pokemon)await _pokemonDAO.BuscarAsync(param);

                    if (pokemon == null)
                    {
                        MessageBox.Show("Nada foi encontrado");
                    }
                    else
                    {
                        CarregarPokemon(pokemon);
                    }
                }
                else
                {
                    Pokemons = await _pokemonDAO.BuscarAsync();

                    if (Pokemons.Count > 0)
                    {
                        this.Invoke(new MethodInvoker(() =>
                        {
                            label1.Text = $"Total : {Pokemons.Count} Pokemons";

                            label1.Visible = true;

                            CarregarPokemon(Pokemons[0]);
                        }));
                    }
                    else
                    {
                        MessageBox.Show("Nenhum pokemon encontrado");
                    }
                }
            }
            catch
            {
                MessageBox.Show("Nennum pokemon encontrado");
            }
        }