public void LoadPokemon() { foreach (var poke in currentView.Save.SerializeData.characterStorage.characterDataDictionary) { Button pokeButton = new Button(); pokeButton.Tag = poke.Value.data; pokeButton.Click += new RoutedEventHandler(EditPoke); Image pokeFace = new Image(); pokeFace.Source = new BitmapImage(new Uri("icons/pokemon/" + poke.Value.data.monsterNo + ".png", UriKind.Relative)); pokeFace.Width = 48; pokeFace.Height = 48; pokeButton.Content = pokeFace; pokeFacesPanel.Children.Add(pokeButton); } Button newPokemon = new Button(); CharacterStorage.ManageData freshpoke = new CharacterStorage.ManageData(); freshpoke.data = new SaveCharacterData(); freshpoke.data.attack = 1; freshpoke.data.exp = 0; freshpoke.data.name = "FreshlyAddedPokemon".ToList(); freshpoke.data.formNo = 0; freshpoke.data.hp = 1; freshpoke.data.id = 1; freshpoke.data.isEvolve = false; freshpoke.data.level = 1; freshpoke.data.monsterNo = 1; freshpoke.data.rareRandom = 6988666; freshpoke.data.potential = new SaveCharacterPoteintialData(); freshpoke.data.potential.slotPropertyTypes = new List <sbyte>(); for (int i = 0; i < 9; i++) { freshpoke.data.potential.slotPropertyTypes.Add(2); } // maybe some day this will be added lol //newPokemon.Tag = freshpoke.data; //newPokemon.Content = "+"; //newPokemon.FontSize = 36; //newPokemon.Click += new RoutedEventHandler(addPoke); //pokeFacesPanel.Children.Add(newPokemon); }
private void addPoke(object sender, RoutedEventArgs e) { Button pokeFace = sender as Button; SaveCharacterData clickedPokemon = (SaveCharacterData)pokeFace.Tag; int keyPair = currentView.Save.SerializeData.characterStorage.characterDataDictionary.Count() + 1; CharacterStorage.ManageData tmpNew = new CharacterStorage.ManageData(); tmpNew.data = clickedPokemon; currentView.Save.SerializeData.characterStorage.characterDataDictionary.Add(keyPair, tmpNew); EditPoke(sender, e); }