private void btn_New_Click(object sender, EventArgs e) { FrmPSRBuilder dlg = new FrmPSRBuilder(this.Document); if (dlg.ShowDialog() == DialogResult.OK) { this.lb_psrs.Items.Add(dlg.Processor); } }
private void btn_Edit_Click(object sender, EventArgs e) { if (lb_psrs.SelectedItems.Count == 1) { var selectedItemIndex = lb_psrs.SelectedIndex; FrmPSRBuilder dlg = new FrmPSRBuilder(this.Document); dlg.Processor = lb_psrs.SelectedItem as Entities.Processor; if (dlg.ShowDialog() == DialogResult.OK) { lb_psrs.Items.RemoveAt(lb_psrs.SelectedIndex); lb_psrs.Items.Insert(selectedItemIndex, dlg.Processor); } } }