コード例 #1
0
        //Mouse Double click event
        private void dgPokemonList1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            pokemon1    = (Pokemon)dgPokemonList1.SelectedItem;
            statsTotal1 = pokedexEntry1.PokemonHP + pokedexEntry1.PokemonDefense + pokedexEntry1.PokemonDefense
                          + pokedexEntry1.PokemonSpecialAttack + pokedexEntry1.PokemonSpeed;
            pokedexEntry1                  = _pokemonManager.GetPokedexEntry(pokemon1.PokemonNumber);
            dgPokemonList1.IsEnabled       = false;
            btnSelectionChange1.Visibility = Visibility.Visible;
            if (dgPokemonList2.IsEnabled == false)
            {
                btnCompare.IsEnabled = true;
                btnBattle.IsEnabled  = true;
            }
            if (cboPokemonVersion1.SelectedItem.ToString() == "Pokemon")
            {
                pokedexEntry1 = _pokemonManager.GetPokedexEntry(pokemon1.PokemonNumber);
            }
            else
            {
                pokedexEntry1 = _pokemonManager.RetrieveAlternateVersionStats(pokemon1.PokemonName);
            }
            barHP_1.Maximum             = 10;
            barAttack_1.Maximum         = 10;
            barDefense_1.Maximum        = 10;
            barSpecialAttack_1.Maximum  = 10;
            barSpecialDefense_1.Maximum = 10;
            barSpeed_1.Maximum          = 10;
            barTotal_1.Maximum          = 50;

            lblPkmnName1.Content       = pokedexEntry1.PokemonNames.ToString();
            lblTypeHolder_1.Content    = pokedexEntry1.PokemonTypes.ToString();
            lblType2Holder_1.Content   = pokedexEntry1.PokemonTypes2.ToString();
            lblAbilityHolder_1.Content = pokedexEntry1.PokemonAbility.ToString();
            if (pokedexEntry1.PokemonAbility != null)
            {
                lblAbility2Holder_1.Content = pokedexEntry1.PokemonAbility.ToString();
            }
            barHP_1.Value                  = pokedexEntry1.PokemonHP;
            lblHPNum_1.Content             = pokedexEntry1.PokemonHP;
            barAttack_1.Value              = pokedexEntry1.PokemonAttack;
            lblAttackNum_1.Content         = pokedexEntry1.PokemonAttack;
            barDefense_1.Value             = pokedexEntry1.PokemonDefense;
            lblDefenseNum_1.Content        = pokedexEntry1.PokemonDefense;
            barSpecialAttack_1.Value       = pokedexEntry1.PokemonSpecialAttack;
            lblSpecialAttackNum_1.Content  = pokedexEntry1.PokemonSpecialAttack;
            barSpecialDefense_1.Value      = pokedexEntry1.PokemonSpecialDefense;
            lblSpecialDefenseNum_1.Content = pokedexEntry1.PokemonSpecialDefense;
            barSpeed_1.Value               = pokedexEntry1.PokemonSpeed;
            lblSpeedNum_1.Content          = pokedexEntry1.PokemonSpeed;
            barTotal_1.Value               = pokedexEntry1.PokemonHP + pokedexEntry1.PokemonDefense + pokedexEntry1.PokemonDefense
                                             + pokedexEntry1.PokemonSpecialAttack + pokedexEntry1.PokemonSpeed;
            lblTotalNum_1.Content = pokedexEntry1.PokemonHP + pokedexEntry1.PokemonDefense + pokedexEntry1.PokemonDefense
                                    + pokedexEntry1.PokemonSpecialAttack + pokedexEntry1.PokemonSpeed;
            PokedexDataObjects.PokedexAppDetails.AppPath = AppContext.BaseDirectory;
            imgPokemon1.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + pokedexEntry1.PokemonImage.ToString()));
        }
コード例 #2
0
        //Change to alternate values
        private void cboAlternates_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cboAlternates.SelectedItem == null)
            {
                //Do nothing
            }
            else
            {
                _pokedexEntry = _pokemonManager.GetPokedexEntry(_pokemonIndex);
                if (cboAlternates.SelectedIndex.Equals(0))
                {
                    DisplayEntry();
                }
                else
                {
                    PokedexEntry alternatePokemon = _pokemonManager.RetrieveAlternateVersionStats(cboAlternates.SelectedItem.ToString());

                    //Changes values to Alternate values
                    lblPokemonName.Text          = alternatePokemon.PokemonNames.ToString();
                    lblType1.Text                = alternatePokemon.PokemonTypes.ToString();
                    lblType2.Text                = alternatePokemon.PokemonTypes.ToString();
                    txtDexText.Text              = alternatePokemon.DexEntry.ToString();
                    lblHeightContainer.Content   = alternatePokemon.PokemonHeight.ToString();
                    lblWeightContainer.Content   = alternatePokemon.PokemonWeight.ToString();
                    lblGenderContainer.Content   = alternatePokemon.PokemonGender.ToString();
                    lblCategoryContainer.Content = alternatePokemon.PokemonCategory.ToString();
                    lblAbility1Container.Content = alternatePokemon.PokemonAbility.ToString();
                    PokedexDataObjects.PokedexAppDetails.AppPath = AppContext.BaseDirectory;

                    imgPokemon.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + alternatePokemon.PokemonImage.ToString()));
                    if (alternatePokemon.PokemonAbility2 == null)
                    {
                        lblAbility2Container.Content = "";
                    }
                    else
                    {
                        lblAbility2Container.Content = alternatePokemon.PokemonAbility2.ToString();
                    }

                    prgHP.Maximum      = 10;
                    prgAttack.Maximum  = 10;
                    prgDefense.Maximum = 10;
                    prgSpAtk.Maximum   = 10;
                    prgSpDef.Maximum   = 10;
                    prgSpeed.Maximum   = 10;

                    prgHP.Value      = alternatePokemon.PokemonHP;
                    prgAttack.Value  = alternatePokemon.PokemonAttack;
                    prgDefense.Value = alternatePokemon.PokemonDefense;
                    prgSpAtk.Value   = alternatePokemon.PokemonSpecialAttack;
                    prgSpDef.Value   = alternatePokemon.PokemonSpecialDefense;
                    prgSpeed.Value   = alternatePokemon.PokemonSpeed;

                    lblHP.Content      = alternatePokemon.PokemonHP.ToString();
                    lblAttack.Content  = alternatePokemon.PokemonAttack.ToString();
                    lblDefense.Content = alternatePokemon.PokemonDefense.ToString();
                    lblSpAtk.Content   = alternatePokemon.PokemonSpecialAttack.ToString();
                    lblSpDef.Content   = alternatePokemon.PokemonSpecialDefense.ToString();
                    lblSpeed.Content   = alternatePokemon.PokemonSpeed.ToString();
                }
            }
        }