private void button3_Click(object sender, System.EventArgs e)
 {
     var newDigimon = new Digimon
     {
         Name = NameText.Text,
         DubName = DubNameText.Text,
         DebutYear = int.TryParse(YearText.Text, out int debutYear) ? debutYear : DateTime.Now.Year,
         Digivolutions = EvolutionsText.Text.Split(',').ToList(),
         Level = LevelText.Text
     };
     if (_digimonList.TryAddDigimon(newDigimon))
     {
         new MessageForm($"New Digimon {newDigimon.Name} added to list").ShowDialog();
     }
     else
     {
         new MessageForm($"No Digimon named {newDigimon.Name} found").ShowDialog();
     }
 }
Example #2
0
 private void xAntibodyButton_Click(object sender, EventArgs e)
 {
     if (_digimonList.DigimonCollection.Any(x => x.XAntibodyNameCheck(_currentDigimon.Name)))
     {
         var digimon = _digimonList.DigimonCollection.FirstOrDefault(x => x.XAntibodyNameCheck(_currentDigimon.Name));
         ChangeCurrentDigimon(digimon.Name);
     }
     else if (_digimonList.TryAddDigimon(new Digimon {
         Name = string.Format("{0} X-Antibody", _currentDigimon.Name)
     }))
     {
         var digimon = _digimonList.DigimonCollection.FirstOrDefault(x => x.XAntibodyNameCheck(_currentDigimon.Name));
         ChangeCurrentDigimon(digimon.Name);
     }
     else if (_digimonList.DigimonCollection.Any(x => (string.Equals(x.Name, string.Format("{0} (2006 Anime Version)", _currentDigimon.Name), StringComparison.OrdinalIgnoreCase))))
     {
         var digimon = _digimonList.DigimonCollection.FirstOrDefault(x => (string.Equals(x.Name, string.Format("{0} (2006 Anime Version)", _currentDigimon.Name), StringComparison.OrdinalIgnoreCase)));
         ChangeCurrentDigimon(digimon.Name);
     }
     _justChanged = false;
 }