Class PrecompiledEventDescriptor<TTarget, THandler>
Definition
Namespace: StardewUI.Framework.Descriptors
Assembly: StardewUI.dll
Statically-typed implementation of an IEventDescriptor with predefined attributes.
public class PrecompiledEventDescriptor<TTarget, THandler> :
StardewUI.Framework.Descriptors.IEventDescriptor,
StardewUI.Framework.Descriptors.IMemberDescriptor
Type Parameters
TTarget
The event's declaring type.
THandler
The delegate type of event handlers.
Inheritance
Object ⇦ PrecompiledEventDescriptor<TTarget, THandler>
Implements
IEventDescriptor, IMemberDescriptor
Members
Constructors
| Name | Description |
|---|---|
| PrecompiledEventDescriptor<TTarget, THandler>(string, Action<TTarget, THandler>, Action<TTarget, THandler>, Type) | Statically-typed implementation of an IEventDescriptor with predefined attributes. |
Properties
| Name | Description |
|---|---|
| ArgsTypeDescriptor | Descriptor for the type of event object (arguments), generally a subtype of EventArgs. |
| DeclaringType | The type on which the member is declared. |
| DelegateParameterCount | Number of parameters that the Invoke method of the DelegateType accepts. |
| DelegateType | The type (subtype of Delegate) that can be added/removed from the event handlers. |
| Name | The member name. |
Methods
| Name | Description |
|---|---|
| Add(Object, Delegate) | Adds an event handler. |
| Remove(Object, Delegate) | Removes an event handler. |
Details
Constructors
PrecompiledEventDescriptor<TTarget, THandler>(string, Action<TTarget, THandler>, Action<TTarget, THandler>, Type)
Statically-typed implementation of an IEventDescriptor with predefined attributes.
public PrecompiledEventDescriptor<TTarget, THandler>(string name, Action<TTarget, THandler> add, Action<TTarget, THandler> remove, System.Type argsType);
Parameters
name string
The event name.
add Action<TTarget, THandler>
Function to add a new event handler to an instance of the target type.
remove Action<TTarget, THandler>
Function to remove an existing event handler from an instance of the target type.
argsType Type
Type of the argument parameter in the THandler delegate.
Properties
ArgsTypeDescriptor
Descriptor for the type of event object (arguments), generally a subtype of EventArgs.
Property Value
DeclaringType
The type on which the member is declared.
Property Value
DelegateParameterCount
Number of parameters that the Invoke method of the DelegateType accepts.
Property Value
Remarks
For precompiled descriptors, this is assumed to always be exactly 2 (sender and args).
DelegateType
The type (subtype of Delegate) that can be added/removed from the event handlers.
Property Value
Name
The member name.
Property Value
Methods
Add(Object, Delegate)
Adds an event handler.
Parameters
target Object
The instance of the DeclaringType on which to subscribe to events.
handler Delegate
The handler to run when the event is raised; must be assignable to the DelegateType.
Remove(Object, Delegate)
Removes an event handler.
Parameters
target Object
The instance of the DeclaringType on which to unsubscribe from events.
handler Delegate
The handler that was previously registered, i.e. via Add(Object, Delegate).