Esempio n. 1
0
 private void updateButton_Click(object sender, RoutedEventArgs e)
 {
     if (Utillity.CheckAddOrUpdateMonsterFields(nameTextBox, attackTextBox, hpTextBox))
     {
         MonsterDB.UpdateMonster(this.MObject);
         MessageBox.Show("Monster updated");
     }
 }
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            if (Utillity.CheckAddOrUpdateMonsterFields(nameTextBox, attackTextBox, hpTextBox))
            {
                Monster m = new Monster {
                    MonsterId = MonsterDB.GetNextMonsterId(),
                    Alive     = (bool)aliveCheckBox.IsChecked ? true : false,
                    Attack    = int.Parse(attackTextBox.Text),
                    HP        = int.Parse(hpTextBox.Text),
                    Name      = nameTextBox.Text
                };

                MonsterDB.InsertMonster(m);
                monsterCollection.Add(m);

                MessageBox.Show("Monster Toegevoegd!");
            }
            else
            {
                MessageBox.Show("Gelieve alle velden in te vullen");
            }
        }