private void btnApply_Click(object sender, EventArgs e)
 {
     TempPokemon.FixChecksum();
     this.SharedPokemon = this.TempPokemon.Clone();
     this.SharedPartyPokemon = new PKMDS.PartyPokemon();
     this.SharedPartyPokemon.PokemonData = this.TempPokemon.Clone();
     CheckApplyButton();
 }
示例#2
0
 private void loadFromFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ToolStripItem menuItem = sender as ToolStripItem;
     if (menuItem != null)
     {
         ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip;
         if (owner != null)
         {
             PKMDS.Pokemon pkm = new PKMDS.Pokemon();
             int slot = 0;
             PictureBox pb = (PictureBox)(owner.SourceControl);
             if (pb.Name.Contains("Party"))
             {
                 int.TryParse(pb.Name.Substring(pb.Name.Length - 2, 2), out slot);
                 slot--;
                 pkmFileOpen.FileName = "";
                 if (pkmFileOpen.ShowDialog() != DialogResult.Cancel)
                 {
                     if (pkmFileOpen.FileName != "")
                     {
                         if (System.IO.File.Exists(pkmFileOpen.FileName))
                         {
                             System.IO.FileInfo file = new System.IO.FileInfo(pkmFileOpen.FileName);
                             pkm = PKMDS.ReadPokemonFile(pkmFileOpen.FileName, file.Extension.ToLower() == "ek6");
                             if (pkm.SpeciesID != 0)
                             {
                                 PKMDS.PartyPokemon ppkm = new PKMDS.PartyPokemon();
                                 ppkm.PokemonData = pkm;
                                 if (sav.GetPartyPokemon(slot).PokemonData.SpeciesID == 0)
                                 {
                                     sav.WithdrawPokemon(ppkm.PokemonData);
                                 }
                                 else
                                 {
                                     sav.SetPartyPokemon(ppkm, slot);
                                 }
                                 UpdateParty();
                             }
                         }
                     }
                 }
             }
             if (pb.Name.Contains("Box"))
             {
                 int.TryParse(pb.Name.Substring(pb.Name.Length - 2, 2), out slot);
                 slot--;
                 pkmFileOpen.FileName = "";
                 if (pkmFileOpen.ShowDialog() != DialogResult.Cancel)
                 {
                     if (pkmFileOpen.FileName != "")
                     {
                         if (System.IO.File.Exists(pkmFileOpen.FileName))
                         {
                             System.IO.FileInfo file = new System.IO.FileInfo(pkmFileOpen.FileName);
                             pkm = PKMDS.ReadPokemonFile(pkmFileOpen.FileName, file.Extension.ToLower() == "ek6");
                             if (pkm.SpeciesID != 0)
                             {
                                 sav.SetStoredPokemon(pkm, sav.CurrentBox, slot);
                                 UpdateBox();
                                 UpdateBoxGrid(sav.CurrentBox);
                                 UpdateBoxCountLabel(sav.CurrentBox);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
示例#3
0
 private PKMDS.PartyPokemon ViewPokemon(PKMDS.PartyPokemon ppkm)
 {
     pkmviewer.SetPokemon(ppkm.PokemonData.Clone());
     pkmviewer.ShowDialog();
     PKMDS.PartyPokemon newppkm = new PKMDS.PartyPokemon();
     newppkm.PokemonData = pkmviewer.SharedPokemon.Clone();
     return newppkm;
 }