Ejemplo n.º 1
0
        private void cmdEditAbility_Click(object sender, EventArgs e)
        {
            Ability selectedAbility = null;

            if (listBoxAttacksBasic.SelectedIndex != -1)
            {
                selectedAbility = (Ability)listBoxAttacksBasic.Items[listBoxAttacksBasic.SelectedIndex];
            }
            if (listBoxAttacksSpecial.SelectedIndex != -1)
            {
                selectedAbility = (Ability)listBoxAttacksSpecial.Items[listBoxAttacksSpecial.SelectedIndex];
            }
            if (listBoxAbilities.SelectedIndex != -1)
            {
                selectedAbility = (Ability)listBoxAbilities.Items[listBoxAbilities.SelectedIndex];
            }
            if (selectedAbility != null)
            {
                var aform  = new AbilityForm(character, selectedAbility);
                var result = aform.ShowDialog();
                if (result == DialogResult.OK)
                {
                    character.addAbility(aform.ability);
                    aform.ability.PropertyChanged += Ability_PropertyChanged;
                    refreshListBoxes();
                }
            }
        }
Ejemplo n.º 2
0
        //============================================================================================================


        //============================================================================================================
        #region Event Methods

        private void buttonAddAbility_Click(object sender, EventArgs e)
        {
            AbilityForm af     = new AbilityForm(character);
            var         result = af.ShowDialog();

            if (result == DialogResult.OK)
            {
                character.addAbility(af.ability);
                af.ability.PropertyChanged += Ability_PropertyChanged;
                refreshListBoxes();
            }
        }