private void btnKnowledge_Click(object sender, EventArgs e) { if (_objCharacter.Created) { List <ListItem> lstDefaultKnowledgeSkills = KnowledgeSkill.DefaultKnowledgeSkills().ToList(); lstDefaultKnowledgeSkills.Sort(CompareListItems.CompareNames); using (frmSelectItem form = new frmSelectItem { Description = LanguageManager.GetString("Label_Options_NewKnowledgeSkill") }) { form.SetDropdownItemsMode(lstDefaultKnowledgeSkills); if (form.ShowDialog() != DialogResult.OK) { return; } KnowledgeSkill skill = new KnowledgeSkill(_objCharacter) { WriteableName = form.SelectedItem }; _objCharacter.SkillsSection.KnowledgeSkills.Add(skill); } } else { _objCharacter.SkillsSection.KnowledgeSkills.Add(new KnowledgeSkill(_objCharacter)); } }
private void btnKnowledge_Click(object sender, EventArgs e) { if (_objCharacter.Created) { using (frmSelectItem form = new frmSelectItem { Description = LanguageManager.GetString("Label_Options_NewKnowledgeSkill") }) { form.SetDropdownItemsMode(KnowledgeSkill.DefaultKnowledgeSkills); if (form.ShowDialog(Program.MainForm) != DialogResult.OK) { return; } KnowledgeSkill skill = new KnowledgeSkill(_objCharacter) { WriteableName = form.SelectedItem }; if (_objCharacter.SkillsSection.HasAvailableNativeLanguageSlots && (skill.IsLanguage || string.IsNullOrEmpty(skill.Type))) { DialogResult eDialogResult = Program.MainForm.ShowMessageBox(this, string.Format(GlobalOptions.CultureInfo, LanguageManager.GetString("Message_NewNativeLanguageSkill"), 1 + ImprovementManager.ValueOf(_objCharacter, Improvement.ImprovementType.NativeLanguageLimit), skill.WriteableName), LanguageManager.GetString("Tip_Skill_NativeLanguage"), MessageBoxButtons.YesNoCancel); if (eDialogResult == DialogResult.Cancel) { return; } if (eDialogResult == DialogResult.Yes) { if (!skill.IsLanguage) { skill.Type = "Language"; } skill.IsNativeLanguage = true; } } _objCharacter.SkillsSection.KnowledgeSkills.Add(skill); } } else { _objCharacter.SkillsSection.KnowledgeSkills.Add(new KnowledgeSkill(_objCharacter)); } }