Class DataModelEvent<T>
Represents a data model event with event arguments of type T
Implements
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public class DataModelEvent<T> : IDataModelEvent where T : DataModelEventArgs
Type Parameters
Name | Description |
---|---|
T |
Constructors
DataModelEvent()
Creates a new instance of the DataModelEvent<T> class with history tracking disabled
Declaration
public DataModelEvent()
DataModelEvent(bool)
Creates a new instance of the DataModelEvent<T>
Declaration
public DataModelEvent(bool trackHistory)
Parameters
Type | Name | Description |
---|---|---|
bool | trackHistory | A boolean indicating whether the last 20 events should be tracked |
Properties
ArgumentsType
Gets the type of arguments this event contains
Declaration
[DataModelIgnore]
public Type ArgumentsType { get; }
Property Value
Type | Description |
---|---|
Type |
EventArgumentsHistory
Gets a queue of the last 20 event arguments
Always empty if TrackHistory is false
Declaration
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
public Queue<T> EventArgumentsHistory { get; }
Property Value
Type | Description |
---|---|
Queue<T> |
EventArgumentsHistoryUntyped
Gets a list of the last 20 event arguments by their base type.
Always empty if TrackHistory is false
Declaration
[DataModelIgnore]
public List<DataModelEventArgs> EventArgumentsHistoryUntyped { get; }
Property Value
Type | Description |
---|---|
List<DataModelEventArgs> |
LastEventArguments
Gets the event arguments of the last time the event was triggered
Declaration
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
public T? LastEventArguments { get; }
Property Value
Type | Description |
---|---|
T |
LastEventArgumentsUntyped
Gets the event arguments of the last time the event was triggered by its base type
Declaration
[DataModelIgnore]
public DataModelEventArgs? LastEventArgumentsUntyped { get; }
Property Value
Type | Description |
---|---|
DataModelEventArgs |
LastTrigger
Gets the last time the event was triggered
Declaration
[DataModelProperty(Name = "Last trigger", Description = "The time at which the event last triggered")]
public DateTime LastTrigger { get; }
Property Value
Type | Description |
---|---|
DateTime |
TimeSinceLastTrigger
Gets the time that has passed since the last trigger
Declaration
[DataModelProperty(Name = "Time since trigger", Description = "The time that has passed since the last trigger")]
public TimeSpan TimeSinceLastTrigger { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
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
Declaration
[DataModelIgnore]
public bool TrackHistory { get; set; }
Property Value
Type | Description |
---|---|
bool |
TriggerCount
Gets the amount of times the event was triggered
Declaration
[DataModelProperty(Description = "The total amount of times this event has triggered since the module was activated")]
public int TriggerCount { get; }
Property Value
Type | Description |
---|---|
int |
TriggerPastParticiple
Gets the past participle for this event shown in the UI
Declaration
[DataModelIgnore]
public string TriggerPastParticiple { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Reset()
Resets the trigger count and history of this data model event
Declaration
public void Reset()
Trigger(T)
Trigger the event with the given eventArgs
Declaration
public void Trigger(T eventArgs)
Parameters
Type | Name | Description |
---|---|---|
T | eventArgs | The 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
Declaration
public void Update()
Events
EventTriggered
Fires when the event is triggered
Declaration
public event EventHandler? EventTriggered
Event Type
Type | Description |
---|---|
EventHandler |