コード例 #1
0
        static async Task Main(string[] args)
        {
            var service = new PokemonService("https://graphql-pokemon.now.sh");

            IEnumerable <Pokemon> pokemons;

            if (args != null && args.Length > 0)
            {
                if (args.Length == 1)
                {
                    pokemons = new List <Pokemon> {
                        await service.GetPokemon(args[0])
                    };
                }
                else
                {
                    pokemons = await service.GetPokemonBatch(args);
                }
            }
            else
            {
                pokemons = await service.GetAllPokemons();
            }

            foreach (var pokemon in pokemons)
            {
                Console.WriteLine(pokemon);
            }
        }
コード例 #2
0
        static async Task Main(string[] args)
        {
            var service = new PokemonService("https://graphql-pokemon.now.sh");

            IEnumerable <Pokemon> pokemons;

            if (args != null && args.Length > 0)
            {
                pokemons = await Task.WhenAll(args.Select(name => service.GetPokemon(name)));
            }
            else
            {
                pokemons = await service.GetAllPokemons();
            }

            foreach (var pokemon in pokemons)
            {
                Console.WriteLine(pokemon);
            }
        }
コード例 #3
0
 public MainViewModel()
 {
     _pokemonService = new PokemonService();
 }
コード例 #4
0
 public PokemonViewModel(AdditionalInfo pokemon)
 {
     _pokemon = pokemon;
     _pokemonService = new PokemonService();
 }