/// <summary> /// Fires a given event and passes it with the correct arguments to the registered event handlers. It returns the <see cref="CollectionEventArgs"/> structure it created and that the event handlers might have modified. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="handler">The event to fire.</param> /// <param name="record">The record the collection belongs to.</param> /// <param name="collection">The collection to pass to the event handlers.</param> /// <returns>A new instance of the <see cref="CollectionEventArgs"/> class that has been passed to every event handler and might have been modified.</returns> public static CollectionEventArgs Fire(Control sender, CollectionEventHandler handler, IEditableDbRecord record, PropertyInfo collection) { var args = new CollectionEventArgs(record, collection); if (handler == null) return args; handler(sender, args); return args; }
/// <summary> /// Copies values from another instance of this class. /// </summary> /// <param name="e">The source to copy from.</param> public void CopyFrom(CollectionEventArgs e) { this.Record = e.Record; this.Collection = e.Collection; }
private void Tree_CollectionSelected(Control sender, CollectionEventArgs e) { if (e.Record == null) { DisableRecordControls(); return; } if (e.Collection == null) { ShowRecordView(); } else { if (RecordCollection.GetCollectionType(e.Collection) == RecordCollection.CollectionType.AssociationWithValue) ShowRecordCollectionWithValues(); else ShowRecordCollection(); } }