private void editItem(object sender, EventArgs e) { if (ItemBox.SelectedItem == null) { return; } Item selected = (Item)ItemBox.SelectedItem; if (selected != null) { string sel = selected.Name; if (selected is Armor) { ArmorForm r = new ArmorForm((Armor)selected.Clone()); r.Saved += ItemSaved; r.Show(); } else if (selected is Shield) { ShieldForm r = new ShieldForm((Shield)selected.Clone()); r.Saved += ItemSaved; r.Show(); } else if (selected is Weapon) { WeaponForm r = new WeaponForm((Weapon)selected.Clone()); r.Saved += ItemSaved; r.Show(); } else if (selected is Pack) { PackForm r = new PackForm((Pack)selected.Clone()); r.Saved += ItemSaved; r.Show(); } else if (selected is Tool) { ToolForm r = new ToolForm((Tool)selected.Clone()); r.Saved += ItemSaved; r.Show(); } else { ItemForm r = new ItemForm(selected.Clone()); r.Saved += ItemSaved; r.Show(); } } }
private void shieldToolStripMenuItem_Click(object sender, EventArgs e) { if (ItemCat.SelectedItem == null) { return; } Shield i = new Shield() { Source = Program.Context.Config.DefaultSource, Category = ImportExtensions.Make(Program.Context, (string)ItemCat.SelectedItem) }; ShieldForm r = new ShieldForm(i); r.Saved += ItemSaved; r.Show(); }