Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
        //Selection changed event
        private void cboPokemonVersion2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            String selectedValue = cboPokemonVersion2.SelectedItem.ToString();

            switch (selectedValue)
            {
            case "Pokemon":
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllPokemon();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;

            case "Shinies":
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllShinies();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;

            case "Megas":
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllMega();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;

            case "Alternates":
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllAlternateForms();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;

            case "Regionals":
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllRegionals();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;

            default:
                dgPokemonList2.Columns.Clear();
                dgPokemonList2.ItemsSource       = _pokemonManager.RetrieveAllPokemon();
                dgPokemonList2.Columns[0].Header = "Pokemon Number";
                dgPokemonList2.Columns[1].Header = "Pokemon Name";
                dgPokemonList2.Columns[2].Header = "Pokemon Region";
                dgPokemonList2.Columns[3].Header = "Pokemon Type";
                dgPokemonList2.Columns[4].Header = "Pokemon Type2";
                dgPokemonList2.Columns.RemoveAt(5);
                dgPokemonList2.Columns.RemoveAt(2);
                dgPokemonList2.Columns.RemoveAt(0);
                dgPokemonList2.Columns[0].Width = 155;
                dgPokemonList2.Columns[1].Width = 155;
                dgPokemonList2.Columns[2].Width = 155;
                break;
            }
        }