private void OnSkillChanging(object sender, SkillChangedEventArgs e) { if (e.NewValue < e.OldValue) { this.SkillPoints++; if (this.SkillPoints > SkillPointsMaximum) { this.SkillPoints = SkillPointsMaximum; MessageBox.Show("You can not decrease this skill."); e.Cancel = true; } } else { this.SkillPoints--; if (this.SkillPoints < 0) { this.SkillPoints = 0; MessageBox.Show("You do not have any Skill Points left."); e.Cancel = true; } } lblSkillPoints.Text = this.SkillPoints.ToString(); }
private void RaiseSkillChangedEvent(int newValue) { if (newValue > this.Maximum) { MessageBox.Show("This skill can not be increased any further.", "Skill Increase Error", MessageBoxButton.OK); return; } else if (newValue < 0) { MessageBox.Show("The skill is already at zero.", "Skill Decrease Error", MessageBoxButton.OK); return; } SkillChangedEventArgs args = new SkillChangedEventArgs(this.Skill, this.Skill.Value, newValue); this.SkillChanging(this, args); if (!args.Cancel) { this.Skill.Value = newValue; this.BindSkill(); this.SkillChanged(this, args); } }
void ctlSkills_SkillChanged(object sender, Perenthia.Controls.SkillChangedEventArgs e) { this.Avatar.Skills[e.Skill.Name].Value = e.NewValue; this.SkillChanged(this, e); }
private void OnSkillChanged(object sender, SkillChangedEventArgs e) { this.SkillChanged(sender, e); }