public IEnumerable<object> EditElements(IEnumerable<object> elementsToEdit) { List<object> result = new List<object>(); foreach (var dto in elementsToEdit.Cast<ObjectView<ClaimDTO>>().Select(v => v.Object)) { try { var dialog = new AddOrEditClaimForm(this, dto); dialog.ShowDialog(_parent); if(dialog.AddedObject!=null) result.Add(dialog.AddedObject); } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return result; }
public object AddElement() { var dialog = new AddOrEditClaimForm(this, null); dialog.ShowDialog(_parent); return dialog.AddedObject; }