private void add_Click(object sender, EventArgs e) { Conf_Emu_Details detailsForm = new Conf_Emu_Details(null); if (detailsForm.ShowDialog() == DialogResult.OK) { emuList.Items.Add(detailsForm.getEmulator()); updateButtonEnablings(); OnChange(this, e); } }
private void edit_Click(object sender, EventArgs e) { Emulator oldEmu = (Emulator)emuList.SelectedItem; string oldTitle = oldEmu.Title; Emulator updatedEmu = null; if (oldEmu.isPc()) { Conf_PC_Details detailsForm = new Conf_PC_Details(oldEmu); if (detailsForm.ShowDialog() == DialogResult.OK) { updatedEmu = detailsForm.getEmulator(); } } else { Conf_Emu_Details detailsForm = new Conf_Emu_Details(oldEmu); if (detailsForm.ShowDialog() == DialogResult.OK) { updatedEmu = detailsForm.getEmulator(); } } if (updatedEmu != null) { if (!ThumbsHandler.Instance.NeedThumbUpdate && oldTitle != updatedEmu.Title) { ThumbsHandler.Instance.NeedThumbUpdate = true; } emuList.SelectedItem = updatedEmu; //Refresh int selectedIndex = emuList.SelectedIndex; List <Emulator> emus = new List <Emulator>(); foreach (Emulator item in emuList.Items) { emus.Add(item); } emuList.Items.Clear(); foreach (Emulator item in emus) { emuList.Items.Add(item); } emuList.SelectedIndex = selectedIndex; OnChange(this, e); } }