public GamePokemonSearchResultsWindow(List <GamePokemonSearchResults> mirageIslandResults)
        {
            InitializeComponent();

            this.gameSaves           = new ObservableCollection <ListViewItem>();
            this.selectedGameSave    = null;
            this.selectedIndex       = -1;
            this.mirageIslandResults = mirageIslandResults;


            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                this.listViewGameSaves.ItemsSource = gameSaves;

                for (int i = 0; i < PokeManager.NumGameSaves; i++)
                {
                    GameSaveFileInfo gameSave = PokeManager.GetGameSaveFileInfoAt(i);
                    if (GetMirageResults(gameSave.GameSave) == null)
                    {
                        continue;
                    }
                    ListViewItem listViewItem = new ListViewItem();
                    FillListViewItem(gameSave, listViewItem);
                    gameSaves.Add(listViewItem);
                }
            }
        }
        public SaveManager()
        {
            InitializeComponent();

            this.gameSaves        = new ObservableCollection <ListViewItem>();
            this.selectedGameSave = null;
            this.selectedIndex    = -1;

            CreateContextMenu();

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                this.listViewGameSaves.ItemsSource = gameSaves;
                this.dropManager = new ListViewDragDropManager <ListViewItem>(listViewGameSaves);

                for (int i = 0; i < PokeManager.NumGameSaves; i++)
                {
                    GameSaveFileInfo gameSave     = PokeManager.GetGameSaveFileInfoAt(i);
                    ListViewItem     listViewItem = new ListViewItem();
                    FillListViewItem(gameSave, listViewItem);
                    gameSaves.Add(listViewItem);
                }
            }
        }
Esempio n. 3
0
        private void AddListViewItem(int gameIndex, object pocketType, string pocket, int count)
        {
            ListViewItem listViewItem = new ListViewItem();

            if (decorationMode)
            {
                listViewItem.Tag = new ItemPocketGameTag(gameIndex, (DecorationTypes)pocketType);
            }
            else
            {
                listViewItem.Tag = new ItemPocketGameTag(gameIndex, (ItemTypes)pocketType);
            }
            listViewItem.SnapsToDevicePixels = true;
            listViewItem.UseLayoutRounding   = true;
            DockPanel dockPanel = new DockPanel();

            dockPanel.Width = 250;

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Horizontal;

            if (gameIndex == -1)
            {
                TextBlock gameName = new TextBlock();
                gameName.Text = PokeManager.Settings.ManagerNickname;
                gameName.VerticalAlignment = VerticalAlignment.Center;
                stackPanel.Children.Add(gameName);
            }
            else
            {
                IGameSave        gameSave     = PokeManager.GetGameSaveAt(gameIndex);
                GameSaveFileInfo gameSaveFile = PokeManager.GetGameSaveFileInfoAt(gameIndex);

                TextBlock gameName     = new TextBlock();
                string    gameTypeName = (gameSave.GameType == GameTypes.PokemonBox ? "Pokémon Box" : gameSave.GameType.ToString());
                if (gameSaveFile.Nickname != "")
                {
                    gameName.Text = gameSaveFile.Nickname + (gameSaveFile.GameType != GameTypes.PokemonBox ? " [" : "");
                }
                else
                {
                    gameName.Text = gameTypeName + (gameSaveFile.GameType != GameTypes.PokemonBox ? " [" : "");
                }
                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.Text = "]";                //  " + pocket;
                ending.VerticalAlignment = VerticalAlignment.Center;

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

            TextBlock itemPocket = new TextBlock();

            itemPocket.VerticalAlignment   = VerticalAlignment.Center;
            itemPocket.HorizontalAlignment = HorizontalAlignment.Right;
            itemPocket.TextAlignment       = TextAlignment.Right;
            itemPocket.Text     = pocket + " ";
            itemPocket.Width    = Double.NaN;
            itemPocket.MinWidth = 10;

            TextBlock itemX = new TextBlock();

            itemX.VerticalAlignment   = VerticalAlignment.Center;
            itemX.HorizontalAlignment = HorizontalAlignment.Right;
            itemX.TextAlignment       = TextAlignment.Right;
            itemX.Text     = "x";
            itemX.MinWidth = 10;

            TextBlock itemCount = new TextBlock();

            itemCount.VerticalAlignment   = VerticalAlignment.Center;
            itemCount.HorizontalAlignment = HorizontalAlignment.Right;
            itemCount.TextAlignment       = TextAlignment.Right;
            itemCount.Width = 30;
            itemCount.Text  = count.ToString();

            listViewItem.Content = dockPanel;
            listViewResults.Items.Add(listViewItem);
            dockPanel.Children.Add(stackPanel);
            dockPanel.Children.Add(itemCount);
            dockPanel.Children.Add(itemX);
            dockPanel.Children.Add(itemPocket);

            DockPanel.SetDock(itemX, Dock.Right);
            DockPanel.SetDock(itemCount, Dock.Right);
            DockPanel.SetDock(stackPanel, Dock.Left);
        }