Exemplo n.º 1
0
        private void DisplayEntry()
        {
            //Displays the entry itself
            cboAlternates.Items.Clear();

            _pokedexEntry = _pokemonManager.GetPokedexEntry(_pokemonIndex);

            List <Pokemon> alternates = _pokemonManager.RetrieveAlternateVersions(_pokedexEntry.PokemonNumbers);

            List <int> stats = new List <int>();

            //adding the stats to the progress bars
            stats.Add(_pokedexEntry.PokemonHP);
            stats.Add(_pokedexEntry.PokemonAttack);
            stats.Add(_pokedexEntry.PokemonDefense);
            stats.Add(_pokedexEntry.PokemonSpecialAttack);
            stats.Add(_pokedexEntry.PokemonSpecialDefense);
            stats.Add(_pokedexEntry.PokemonSpeed);

            //Setting the content text
            lblPokemonName.Text = _pokedexEntry.PokemonNames.ToString();
            //They were not in the last games on the DS and there were not shiny versions
            if (lblPokemonName.Text == "Meltan" || lblPokemonName.Text == "Melmetal")
            {
                cboAlternates.Visibility = Visibility.Hidden;
            }
            else
            {
                cboAlternates.Visibility = Visibility.Visible;
            }
            lblPokemonNumberText.Text    = _pokedexEntry.PokemonNumbers.ToString();
            lblType1.Text                = _pokedexEntry.PokemonTypes.ToString();
            lblType2.Text                = _pokedexEntry.PokemonTypes2.ToString();
            txtDexText.Text              = _pokedexEntry.DexEntry.ToString();
            lblHeightContainer.Content   = _pokedexEntry.PokemonHeight.ToString();
            lblWeightContainer.Content   = _pokedexEntry.PokemonWeight.ToString();
            lblGenderContainer.Content   = _pokedexEntry.PokemonGender.ToString();
            lblCategoryContainer.Content = _pokedexEntry.PokemonCategory.ToString();
            lblAbility1Container.Content = _pokedexEntry.PokemonAbility.ToString();
            lblAbility2Container.Content = _pokedexEntry.PokemonAbility2.ToString();
            cboAlternates.Items.Add(_pokedexEntry.PokemonNames.ToString());
            PokedexDataObjects.PokedexAppDetails.AppPath = AppContext.BaseDirectory;

            evo1           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo1) - 1);
            imgEvo1.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo1.PokemonImage.ToString()));

            if (_pokedexEntry.Evo2 != "")
            {
                evo2           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo2) - 1);
                imgEvo2.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo2.PokemonImage.ToString()));
            }
            else
            {
                imgEvo2.Source = null;
            }
            if (_pokedexEntry.Evo3 != "")
            {
                evo3           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo3) - 1);
                imgEvo3.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo3.PokemonImage.ToString()));
            }
            else
            {
                imgEvo3.Source = null;
            }
            if (_pokedexEntry.Evo4 != "")
            {
                evo4           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo4) - 1);
                imgEvo4.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo4.PokemonImage.ToString()));
            }
            else
            {
                imgEvo4.Source = null;
            }
            if (_pokedexEntry.Evo5 != "")
            {
                evo5           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo5) - 1);
                imgEvo5.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo5.PokemonImage.ToString()));
            }
            else
            {
                imgEvo5.Source = null;
            }
            if (_pokedexEntry.Evo6 != "")
            {
                evo6           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo6) - 1);
                imgEvo6.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo6.PokemonImage.ToString()));
            }
            else
            {
                imgEvo6.Source = null;
            }
            if (_pokedexEntry.Evo7 != "")
            {
                evo7           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo7) - 1);
                imgEvo7.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo7.PokemonImage.ToString()));
            }
            else
            {
                imgEvo7.Source = null;
            }
            if (_pokedexEntry.Evo8 != "")
            {
                evo8           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo8) - 1);
                imgEvo8.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo8.PokemonImage.ToString()));
            }
            else
            {
                imgEvo8.Source = null;
            }
            if (_pokedexEntry.Evo9 != "")
            {
                evo9           = _pokemonManager.GetPokedexEntry(Convert.ToInt32(_pokedexEntry.Evo9) - 1);
                imgEvo9.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + evo9.PokemonImage.ToString()));
            }
            else
            {
                imgEvo9.Source = null;
            }

            imgPokemon.Source = new BitmapImage(new Uri(PokedexAppDetails.ImagePath + _pokedexEntry.PokemonImage.ToString()));

            //Adding alternates to list
            foreach (Pokemon alternate in alternates)
            {
                cboAlternates.Items.Add(alternate.PokemonName);
            }

            //Setting the maximum of the progress bars
            prgHP.Maximum      = 10;
            prgAttack.Maximum  = 10;
            prgDefense.Maximum = 10;
            prgSpAtk.Maximum   = 10;
            prgSpDef.Maximum   = 10;
            prgSpeed.Maximum   = 10;

            //Setting the actual values of the progress bars
            prgHP.Value      = _pokedexEntry.PokemonHP;
            prgAttack.Value  = _pokedexEntry.PokemonAttack;
            prgDefense.Value = _pokedexEntry.PokemonDefense;
            prgSpAtk.Value   = _pokedexEntry.PokemonSpecialAttack;
            prgSpDef.Value   = _pokedexEntry.PokemonSpecialDefense;
            prgSpeed.Value   = _pokedexEntry.PokemonSpeed;

            //Setting the label values
            lblHP.Content      = _pokedexEntry.PokemonHP.ToString();
            lblAttack.Content  = _pokedexEntry.PokemonAttack.ToString();
            lblDefense.Content = _pokedexEntry.PokemonDefense.ToString();
            lblSpAtk.Content   = _pokedexEntry.PokemonSpecialAttack.ToString();
            lblSpDef.Content   = _pokedexEntry.PokemonSpecialDefense.ToString();
            lblSpeed.Content   = _pokedexEntry.PokemonSpeed.ToString();
            disableNullButtons();
            lblStatusMessage.Content = "Viewing " + _pokedexEntry.PokemonNames;
        }