Table of Contents

Class DataModelEvent<T>

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a data model event with event arguments of type T

public class DataModelEvent<T> : IDataModelEvent where T : DataModelEventArgs

Type Parameters

T
Inheritance
object
DataModelEvent<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

trackHistory bool

A 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

Type

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

List<DataModelEventArgs>

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

DataModelEventArgs

LastTrigger

Gets the last time the event was triggered

public DateTime LastTrigger { get; }

Property Value

DateTime

TimeSinceLastTrigger

Gets the time that has passed since the last trigger

public TimeSpan TimeSinceLastTrigger { get; }

Property Value

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

public bool TrackHistory { get; set; }

Property Value

bool

TriggerCount

Gets the amount of times the event was triggered

public int TriggerCount { get; }

Property Value

int

TriggerPastParticiple

Gets the past participle for this event shown in the UI

public string TriggerPastParticiple { get; }

Property Value

string

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

eventArgs T

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

public void Update()

Events

EventTriggered

Fires when the event is triggered

public event EventHandler? EventTriggered

Event Type

EventHandler