Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmNPCCharacterSkillAddEdit characterSkillAddEdit = new frmNPCCharacterSkillAddEdit(character);

            if (characterSkillAddEdit.ShowDialog() == DialogResult.OK)
            {
                var          skill = characterSkillAddEdit.Skill;
                ListViewItem lvi   = new ListViewItem();
                lvi.Text = skill.id;
                lvi.SubItems.Add(skill.value);
                skillListView.Items.Add(lvi);
            }
        }
Example #2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            var lvi           = skillListView.SelectedItems[0];
            var selectedIndex = skillListView.SelectedIndices[0];

            MBNPCCharacterSkill oldSkill = new MBNPCCharacterSkill();

            oldSkill.id    = lvi.SubItems[0].Text;
            oldSkill.value = lvi.SubItems[1].Text;

            frmNPCCharacterSkillAddEdit characterSkillAddEdit = new frmNPCCharacterSkillAddEdit(character, true, oldSkill);

            if (characterSkillAddEdit.ShowDialog() == DialogResult.OK)
            {
                var          skill   = characterSkillAddEdit.Skill;
                ListViewItem newItem = new ListViewItem();
                newItem.Text = skill.id;
                newItem.SubItems.Add(skill.value);
                skillListView.Items.Insert(selectedIndex, newItem);
            }
        }