Exemplo n.º 1
0
        private void btnRemovePokemon_Click(object sender, RoutedEventArgs e)
        {
            Pokemon selectedPokemon = new Pokemon();
            var     selectedItem    = dgMyPokemonList.SelectedItem;

            selectedPokemon          = (Pokemon)selectedItem;
            lblStatusMessage.Content = "Removed " + _pokemon.PokemonName;

            //Remove regional variant
            if (btnRemovePokemon.Content.Equals("Remove Regional"))
            {
                _pokemonManager.RemoveRegionalPokemon(selectedPokemon.AlternatePokemonNumber, UserID);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyRegionalPokemon(UserID);
                ResetColumns();
            }
            //Remove Mega Variant
            else if (btnRemovePokemon.Content.Equals("Remove Mega"))
            {
                _pokemonManager.RemoveMegaPokemon(selectedPokemon.AlternatePokemonNumber, UserID);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyMegaPokemon(UserID);
                ResetColumns();
            }
            //Remove alternate version
            else if (btnRemovePokemon.Content.Equals("Remove Alternate"))
            {
                _pokemonManager.RemoveAlternatePokemon(selectedPokemon.AlternatePokemonNumber, UserID);
                dgMyPokemonList.ItemsSource       = _pokemonManager.RetrieveMyAlternatePokemon(UserID);
                dgMyPokemonList.Columns[0].Header = "Pokemon Number";
                ResetColumns();
            }
            //Remove normal pokemon
            else if (btnRemovePokemon.Content.Equals("Remove Pokemon"))
            {
                _pokemonManager.RemovePokemon(selectedPokemon.PokemonNumber, UserID);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyPokemon(UserID);
                ResetColumns();
            }
            //Remove Shiny Variant
            else
            {
                _pokemonManager.RemoveShinyPokemon(selectedPokemon.AlternatePokemonNumber, UserID);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyShinyPokemon(UserID);
                ResetColumns();
            }
        }