Exemple #1
0
        private void btnAddPokemon_Click(object sender, RoutedEventArgs e)
        {
            // Used for what type of list to add to
            string pokemonVariant = "Normal";

            if (btnAddPokemon.Content.Equals("Add Pokemon"))
            {
                //List of all normal pokemon
                List <Pokemon> normalPokemon = new List <Pokemon>();
                normalPokemon = _pokemonManager.RetrieveAllPokemon();

                //Add normal pokemon
                var PokedexList = new frmAddPokemonToList(normalPokemon, UserID, pokemonVariant);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyPokemon(UserID);
                ResetColumns();
                lblStatusMessage.Content = "Went to add pokemon";
            }
            // Add alternate Version
            else if (btnAddPokemon.Content.Equals("Add Alternate Version"))
            {
                //list of alternate pokemon
                List <Pokemon> alternatePokemon = new List <Pokemon>();
                alternatePokemon = _pokemonManager.RetrieveAllAlternateForms();
                //Used for setting which kind of pokemon to add to list
                pokemonVariant = "Alternate";
                //Add to alternateuserstore
                var PokedexList = new frmAddPokemonToList(alternatePokemon, UserID, pokemonVariant);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyAlternatePokemon(UserID);
                ResetColumns();
            }
            //Add mega
            else if (btnAddPokemon.Content.Equals("Add Mega Pokemon"))
            {
                //List of Mega pokemon
                List <Pokemon> alternatePokemon = new List <Pokemon>();
                alternatePokemon = _pokemonManager.RetrieveAllMega();
                //Used to acknowledge we want mega pokemon
                pokemonVariant = "Mega";
                //Add to alternateuserstore
                var PokedexList = new frmAddPokemonToList(alternatePokemon, UserID, pokemonVariant);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyMegaPokemon(UserID);
                ResetColumns();
            }
            //Add regional variant
            else if (btnAddPokemon.Content.Equals("Add Regional Variant"))
            {
                //List of regional variant pokemon
                List <Pokemon> regionalPokemon = new List <Pokemon>();
                regionalPokemon = _pokemonManager.RetrieveAllRegionals();
                //Used to know that we want to add a regional variant
                pokemonVariant = "Regional";
                //Add to REgionalList
                var PokedexList = new frmAddPokemonToList(regionalPokemon, UserID, pokemonVariant);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyRegionalPokemon(UserID);
                ResetColumns();
            }
            //Add Shiny
            else
            {
                //Only other type is Shiny so I create a new list of Shiny pokemon
                List <Pokemon> shinyPokemon = new List <Pokemon>();
                shinyPokemon   = _pokemonManager.RetrieveAllShinies();
                pokemonVariant = "Shiny";
                // add shiny
                var PokedexList = new frmAddPokemonToList(shinyPokemon, UserID, pokemonVariant);
                dgMyPokemonList.ItemsSource = _pokemonManager.RetrieveMyShinyPokemon(UserID);
                ResetColumns();
            }
        }