private void FillComboBoxItem(int gameIndex, ComboBoxItem comboBoxItem)
        {
            IGameSave gameSave = PokeManager.GetGameSaveAt(gameIndex);

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Horizontal;

            /*Image gameImage = new Image();
             * BitmapImage bitmap = ResourceDatabase.GetImageFromName(gameSave.GameType.ToString() + "Physical");
             * gameImage.Source = bitmap;
             * if (bitmap == null)
             *      gameImage.Width = 20;
             * else
             *      gameImage.Width = bitmap.PixelWidth * (20.0 / bitmap.PixelHeight);
             * gameImage.Height = 20;
             * gameImage.VerticalAlignment = VerticalAlignment.Center;*/

            TextBlock gameName     = new TextBlock();
            string    gameTypeName = (gameSave.GameType == GameTypes.PokemonBox ? "Pokémon Box" : gameSave.GameType.ToString());

            if (PokeManager.GetGameSaveFileInfoNickname(gameIndex) != "")
            {
                gameName.Text = PokeManager.GetGameSaveFileInfoNickname(gameIndex) + (gameSave.GameType != GameTypes.PokemonBox && gameSave.GameType != GameTypes.Any ? " [" : "");
            }
            else
            {
                gameName.Text = gameTypeName + (gameSave.GameType != GameTypes.PokemonBox && gameSave.GameType != GameTypes.Any ? " [" : "");
            }
            gameName.VerticalAlignment = VerticalAlignment.Center;
            //gameName.Margin = new Thickness(5, 0, 0, 0);

            TextBlock trainerName = new TextBlock();

            trainerName.Text              = gameSave.TrainerName;
            trainerName.Foreground        = new SolidColorBrush(gameSave.TrainerGender == Genders.Male ? Color.FromRgb(32, 128, 248) : (gameSave.TrainerGender == Genders.Female ? Color.FromRgb(248, 24, 168) : Color.FromRgb(0, 0, 0)));
            trainerName.VerticalAlignment = VerticalAlignment.Center;

            TextBlock ending = new TextBlock();

            ending.VerticalAlignment = VerticalAlignment.Center;
            ending.Text = "]";

            //stackPanel.Children.Add(gameImage);
            stackPanel.Children.Add(gameName);
            if (gameSave.GameType != GameTypes.PokemonBox && gameSave.GameType != GameTypes.Any)
            {
                stackPanel.Children.Add(trainerName);
                stackPanel.Children.Add(ending);
            }

            comboBoxItem.Content = stackPanel;
            comboBoxItem.Tag     = gameIndex;
        }
Example #2
0
        private void OnTooltipOpening(object sender, ToolTipEventArgs e)
        {
            IPokemon pokemon = hoverSelection.Tag as IPokemon;

            if (pokemon.ContainerIndex == -1)
            {
                pokemon            = pokemon.PokemonFinder.Pokemon;
                hoverSelection.Tag = pokemon;
            }

            if (pokemon.IsReleased)
            {
                hoverSelection.ToolTip = "(Released)";
            }
            else if (pokemon.IsMoving)
            {
                hoverSelection.ToolTip = "(Moving)";
            }
            else if (pokemon.ContainerIndex == -1)
            {
                hoverSelection.ToolTip = "(Unable to Find - This shouldn't happen)";
            }
            else
            {
                StackPanel tooltip = new StackPanel();
                tooltip.Orientation = Orientation.Horizontal;

                TextBlock gameName     = new TextBlock();
                string    gameTypeName = (pokemon.GameSave.GameType == GameTypes.PokemonBox ? "Pokémon Box" : pokemon.GameSave.GameType.ToString());
                if (PokeManager.GetGameSaveFileInfoNickname(pokemon.GameSave.GameIndex) != "")
                {
                    gameName.Text = PokeManager.GetGameSaveFileInfoNickname(pokemon.GameSave.GameIndex) + (pokemon.GameSave.GameType != GameTypes.PokemonBox && pokemon.GameSave.GameType != GameTypes.Any ? " [" : "");
                }
                else
                {
                    gameName.Text = gameTypeName + (pokemon.GameSave.GameType != GameTypes.PokemonBox && pokemon.GameSave.GameType != GameTypes.Any ? " [" : " ");
                }
                gameName.VerticalAlignment = VerticalAlignment.Center;

                TextBlock trainerName = new TextBlock();
                trainerName.Text              = pokemon.GameSave.TrainerName;
                trainerName.Foreground        = new SolidColorBrush(pokemon.GameSave.TrainerGender == Genders.Male ? Color.FromRgb(32, 128, 248) : (pokemon.GameSave.TrainerGender == Genders.Female ? Color.FromRgb(248, 24, 168) : Color.FromRgb(0, 0, 0)));
                trainerName.VerticalAlignment = VerticalAlignment.Center;

                TextBlock ending = new TextBlock();
                ending.VerticalAlignment = VerticalAlignment.Center;
                ending.Text = "]";

                TextBlock storage = new TextBlock();
                storage.VerticalAlignment = VerticalAlignment.Center;
                storage.Text = " (";
                int indexOf = pokemon.PokeContainer.IndexOf(pokemon);
                if (pokemon.PokeContainer.Type == ContainerTypes.Box)
                {
                    if (pokemon.PokePC is ManagerPokePC)
                    {
                        storage.Text += "Row " + (((ManagerPokePC)pokemon.PokePC).RowIndex + 1).ToString() + " \"" + ((ManagerPokePC)pokemon.PokePC).Name + "\" ";
                    }
                    storage.Text += "Box " + ((pokemon.PokeContainer as IPokeBox).BoxNumber + 1).ToString() + " \"" + (pokemon.PokeContainer as IPokeBox).Name.ToString() + "\"";
                }
                else if (pokemon.PokeContainer.Type == ContainerTypes.Party)
                {
                    storage.Text += "Party Slot " + (indexOf + 1).ToString();
                }
                else if (pokemon.PokeContainer.Type == ContainerTypes.Daycare)
                {
                    if (indexOf == 2 || pokemon.PokeContainer.NumSlots == 1)
                    {
                        storage.Text += "Single Daycare";
                    }
                    else
                    {
                        storage.Text += "Double Daycare Slot " + (indexOf + 1).ToString();
                    }
                }
                else if (pokemon.PokeContainer.Type == ContainerTypes.Purifier)
                {
                    storage.Text += "Purifier Chamber " + (((XDPurificationChamber)pokemon.PokeContainer).ChamberNumber + 1).ToString() + " ";
                    if (indexOf == 0)
                    {
                        storage.Text += "Inside";
                    }
                    else
                    {
                        storage.Text += "Outside Slot " + indexOf.ToString();
                    }
                }
                storage.Text += ")";


                tooltip.Children.Add(gameName);
                if (pokemon.GameSave.GameType != GameTypes.PokemonBox && pokemon.GameSave.GameType != GameTypes.Any)
                {
                    tooltip.Children.Add(trainerName);
                    tooltip.Children.Add(ending);
                }
                tooltip.Children.Add(storage);

                hoverSelection.ToolTip = tooltip;
            }
        }