Class DataModelEvent<T>
Represents a data model event with event arguments of type T
public class DataModelEvent<T> : IDataModelEvent where T : DataModelEventArgs
Type Parameters
T
- Inheritance
-
objectDataModelEvent<T>
- Implements
Constructors
DataModelEvent()
Creates a new instance of the DataModelEvent<T> class with history tracking disabled
public DataModelEvent()
DataModelEvent(bool)
Creates a new instance of the DataModelEvent<T>
public DataModelEvent(bool trackHistory)
Parameters
trackHistoryboolA boolean indicating whether the last 20 events should be tracked
Properties
ArgumentsType
Gets the type of arguments this event contains
public Type ArgumentsType { get; }
Property Value
EventArgumentsHistory
Gets a queue of the last 20 event arguments
Always empty if TrackHistory is false
public Queue<T> EventArgumentsHistory { get; }
Property Value
- Queue<T>
EventArgumentsHistoryUntyped
Gets a list of the last 20 event arguments by their base type.
Always empty if TrackHistory is false
public List<DataModelEventArgs> EventArgumentsHistoryUntyped { get; }
Property Value
LastEventArguments
Gets the event arguments of the last time the event was triggered
public T? LastEventArguments { get; }
Property Value
- T
LastEventArgumentsUntyped
Gets the event arguments of the last time the event was triggered by its base type
public DataModelEventArgs? LastEventArgumentsUntyped { get; }
Property Value
LastTrigger
Gets the last time the event was triggered
public DateTime LastTrigger { get; }
Property Value
TimeSinceLastTrigger
Gets the time that has passed since the last trigger
public TimeSpan TimeSinceLastTrigger { get; }
Property Value
TrackHistory
Gets or sets a boolean indicating whether the last 20 events should be tracked
Note: setting this to false will clear the current history
public bool TrackHistory { get; set; }
Property Value
TriggerCount
Gets the amount of times the event was triggered
public int TriggerCount { get; }
Property Value
TriggerPastParticiple
Gets the past participle for this event shown in the UI
public string TriggerPastParticiple { get; }
Property Value
Methods
Reset()
Resets the trigger count and history of this data model event
public void Reset()
Trigger(T)
Trigger the event with the given eventArgs
public void Trigger(T eventArgs)
Parameters
eventArgsTThe event argument to pass to the event
Update()
Updates the event, not required for standard events but included in case your custom event needs to update every tick
public void Update()
Events
EventTriggered
Fires when the event is triggered
public event EventHandler? EventTriggered