private void edit_hero() { List <Hero> hero = (Session.Project.Heroes.Contains(this.SelectedHero) ? Session.Project.Heroes : Session.Project.InactiveHeroes); int num = hero.IndexOf(this.SelectedHero); HeroForm heroForm = new HeroForm(this.SelectedHero); if (heroForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { hero[num] = heroForm.Hero; Session.Modified = true; this.update_view(); } }
private void AddBtn_Click(object sender, EventArgs e) { HeroForm heroForm = new HeroForm(new Hero() { Name = "New Character" }); if (heroForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.add_hero(heroForm.Hero); this.update_view(); } }
private void AddBtn_Click(object sender, EventArgs e) { Hero hero = new Hero(); hero.Name = "New Character"; HeroForm dlg = new HeroForm(hero); if (dlg.ShowDialog() == DialogResult.OK) { add_hero(dlg.Hero); update_view(); } }
void edit_hero() { List <Hero> list = Session.Project.Heroes.Contains(SelectedHero) ? Session.Project.Heroes : Session.Project.InactiveHeroes; int index = list.IndexOf(SelectedHero); HeroForm dlg = new HeroForm(SelectedHero); if (dlg.ShowDialog() == DialogResult.OK) { list[index] = dlg.Hero; Session.Modified = true; update_view(); } }