コード例 #1
0
        //Adds pokemon
        private void dgAddPokemon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var selectedItem    = dgAddPokemon.SelectedItem;
            var selectedPokemon = (Pokemon)selectedItem;
            var pokemonNumber   = selectedPokemon.PokemonNumber;
            var versionNumber   = selectedPokemon.AlternatePokemonNumber;

            //Consider a switch here
            if (_pokemonVariant == "Normal")
            {
                _pokemonManager.StoreNormalPokemon(pokemonNumber, _userID);

                this.Close();
            }
            else if (_pokemonVariant == "Alternate")
            {
                _pokemonManager.StoreAlternatePokemon(versionNumber, _userID);
                this.Close();
            }
            else if (_pokemonVariant == "Regional")
            {
                _pokemonManager.StoreRegionalPokemon(versionNumber, _userID);
                this.Close();
            }
            else if (_pokemonVariant == "Mega")
            {
                _pokemonManager.StoreMegaPokemon(versionNumber, _userID);
                this.Close();
            }
            else
            {
                _pokemonManager.StoreShinyPokemon(versionNumber, _userID);
                this.Close();
            }
        }