private void buttonNew_Click(object sender, EventArgs e) { if (type == 1) { Platform item = new Platform(++Data.data.platformLastID); FormPlatform form = new FormPlatform(item); if (form.ShowDialog() == DialogResult.OK) { ((List <Platform>)list).Add(item); } } if (type == 2) { Medium item = new Medium(++Data.data.mediumLastID); FormMedium form = new FormMedium(item); if (form.ShowDialog() == DialogResult.OK) { ((List <Medium>)list).Add(item); } } if (type == 3) { Genre item = new Genre(++Data.data.genreLastID); FormGenre form = new FormGenre(item); if (form.ShowDialog() == DialogResult.OK) { ((List <Genre>)list).Add(item); } } DrawList(); }
private void buttonEdit_Click(object sender, EventArgs e) { if (listViewCat.SelectedItems.Count == 0) { return; } if (type == 1) { FormPlatform form = new FormPlatform((Platform)listViewCat.SelectedItems[0].Tag); form.ShowDialog(); } if (type == 2) { FormMedium form = new FormMedium((Medium)listViewCat.SelectedItems[0].Tag); form.ShowDialog(); } if (type == 3) { FormGenre form = new FormGenre((Genre)listViewCat.SelectedItems[0].Tag); form.ShowDialog(); } DrawList(); }