示例#1
0
        private void TrapList_DoubleClick(object sender, EventArgs e)
        {
            if (SelectedSkill != null)
            {
                int index = fTrapElement.Trap.Skills.IndexOf(SelectedSkill);

                TrapSkillForm dlg = new TrapSkillForm(SelectedSkill, fTrapElement.Trap.Level);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    fTrapElement.Trap.Skills[index] = dlg.SkillData;
                    update_view();
                }
            }

            if (SelectedCountermeasure != null)
            {
                int index = fTrapElement.Trap.Countermeasures.IndexOf(SelectedCountermeasure);

                TrapCountermeasureForm dlg = new TrapCountermeasureForm(SelectedCountermeasure, fTrapElement.Trap.Level);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    fTrapElement.Trap.Countermeasures[index] = dlg.Countermeasure;
                    update_view();
                }
            }
        }
 private void TrapList_DoubleClick(object sender, EventArgs e)
 {
     if (this.SelectedSkill != null)
     {
         int           skillData     = this.fTrapElement.Trap.Skills.IndexOf(this.SelectedSkill);
         TrapSkillForm trapSkillForm = new TrapSkillForm(this.SelectedSkill, this.fTrapElement.Trap.Level);
         if (trapSkillForm.ShowDialog() == DialogResult.OK)
         {
             this.fTrapElement.Trap.Skills[skillData] = trapSkillForm.SkillData;
             this.update_view();
         }
     }
     if (this.SelectedCountermeasure != null)
     {
         int countermeasure = this.fTrapElement.Trap.Countermeasures.IndexOf(this.SelectedCountermeasure);
         TrapCountermeasureForm trapCountermeasureForm = new TrapCountermeasureForm(this.SelectedCountermeasure, this.fTrapElement.Trap.Level);
         if (trapCountermeasureForm.ShowDialog() == DialogResult.OK)
         {
             this.fTrapElement.Trap.Countermeasures[countermeasure] = trapCountermeasureForm.Countermeasure;
             this.update_view();
         }
     }
 }