//------------------------------------------------------------------------- private void uiRemoveRealisation_Click(object sender, EventArgs e) { try { Entity entity = (Entity)uiRealisations.SelectedItem; if (entity == null) { return; } // Sure? if (MessageBox.Show( "Remove '" + entity.Title + "'?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ActiveRoadmap.RemoveEntity(entity); PopulateEntityList <RealisationEntity>(uiRealisations); } } catch (Exception ex) { Program.HandleException(ex); } }
//------------------------------------------------------------------------- private void uiAddRealisation_Click(object sender, EventArgs e) { try { // Add new entity. Entity entity = ActiveRoadmap.AddEntity <RealisationEntity>(); // Show the entity properties dialog. EntityDlg dlg = new EntityDlg(ActiveRoadmap, entity); if (dlg.ShowDialog(this) == DialogResult.OK) { PopulateEntityList <RealisationEntity>(uiRealisations); uiRealisations.SelectedItem = entity; } else { ActiveRoadmap.RemoveEntity(entity); } dlg.Dispose(); } catch (Exception ex) { Program.HandleException(ex); } }