Beispiel #1
0
        protected async void butCapturar_Click(object sender, EventArgs e)
        {
            if (textPedirPokemon.Text == "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Debe introducir un nombre de pokemon válido')", true);
            }
            else
            {
                try
                {
                    PokemonApi pokemonApi = await new DALPokemonApi().recuperarPokemonAPI(textPedirPokemon.Text);
                    if (pokemonApi != null)
                    {
                        DALPokegotchi dALPokegotchi = new DALPokegotchi();
                        if (!dALPokegotchi.ComprobarPokemonEnTabla(pokemonApi.Nombre))
                        {
                            dALPokegotchi.InsertarPokemon(pokemonApi);
                        }
                        Pokemon pokemonUsuario = dALPokegotchi.ObtenerIdPokemon(pokemonApi.Nombre);

                        dALPokegotchi.InsertarEnPokegotchi(pokemonUsuario, Convert.ToInt32(Session["userId"]));

                        recargarListPokegotchiPorIdUsuario(Convert.ToInt32(Session["userId"]));
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('El Pokémon introducido no existe, prueba con otro nombre')", true);
                    }
                }
                catch (Exception error) { }
            }
        }
Beispiel #2
0
        public async void DisplayPowerItems(object sender, EventArgs argss)
        {
            PokemonApi api = new PokemonApi();

            if (!frm_PowerItemSelection.IsVisible)
            {
                lv_PowerItems.ItemsSource        = api.GetPowerItems();
                frm_PowerItemSelection.IsVisible = true;
                await frm_PowerItemSelection.ScaleTo(1, 250);
            }
            else
            {
                await frm_PowerItemSelection.ScaleTo(.1, 250);

                frm_PowerItemSelection.IsVisible = false;
            }
        }
Beispiel #3
0
        public async void GenSelected(object sender, EventArgs args)
        {
            var lbl = sender as Label;
            var acI = (lbl.Parent as Grid).Children.ElementAt(1) as ActivityIndicator;

            lbl.IsVisible = false;
            acI.IsVisible = true;
            acI.IsRunning = true;
            List <Pokemon> pokemons;
            PokemonApi     api = new PokemonApi();

            pokemons = await api.Pokemons(lbl.Text);

            lv_Pokemons.ItemsSource = pokemons;
            lbl.IsVisible           = true;
            acI.IsVisible           = false;
            acI.IsRunning           = false;
            sl_Gens.IsVisible       = false;
            sl_Pokemons.IsVisible   = true;
            lv_Pokemons.IsVisible   = true;
        }
Beispiel #4
0
        public void DisplayUsableItem(object sender, EventArgs e)
        {
            var lbl = sender as Label;
            var acI = (lbl.Parent as Grid).Children.ElementAt(1) as ActivityIndicator;

            lbl.IsVisible = false;
            acI.IsVisible = true;
            acI.IsRunning = true;
            List <UsableItems> usableItems;
            PokemonApi         api = new PokemonApi();

            switch (lbl.Text)
            {
            case "Vitamin":
                usableItems          = api.GetVitamins();
                lv_Items.ItemsSource = usableItems;
                break;

            case "Wing":
                usableItems          = api.GetWings();
                lv_Items.ItemsSource = usableItems;
                break;

            case "Berry":
                usableItems          = api.GetBerries();
                lv_Items.ItemsSource = usableItems;
                break;
            }

            lbl.IsVisible            = true;
            acI.IsVisible            = false;
            acI.IsRunning            = false;
            sl_UsableItems.IsVisible = false;
            sl_Items.IsVisible       = true;
            lv_Items.IsVisible       = true;
        }