Class PluginFeature
Represents an feature of a certain type provided by a plugin
public abstract class PluginFeature : CorePropertyChanged, IDisposable
- Inheritance
-
objectCorePropertyChangedPluginFeature
- Implements
- Derived
Properties
Id
Gets the identifier of this plugin feature
public string Id { get; }
Property Value
Info
Gets the plugin feature info related to this feature
public PluginFeatureInfo Info { get; }
Property Value
IsEnabled
Gets whether the plugin is enabled
public bool IsEnabled { get; }
Property Value
Plugin
Gets the plugin that provides this feature
public Plugin Plugin { get; }
Property Value
Profiler
Gets the profiler that can be used to take profiling measurements
public Profiler Profiler { get; }
Property Value
Methods
AddTimedUpdate(TimeSpan, Action<double>, string?)
Registers a timed update that whenever the plugin is enabled calls the provided action at the
provided
interval
public TimedUpdateRegistration AddTimedUpdate(TimeSpan interval, Action<double> action, string? name = null)
Parameters
intervalTimeSpanThe interval at which the update should occur
actionAction<double>The action to call every time the interval has passed. The delta time parameter represents the time passed since the last update in seconds
namestringAn optional name used in exceptions and profiling
Returns
- TimedUpdateRegistration
The resulting plugin update registration which can be used to stop the update
AddTimedUpdate(TimeSpan, Func<double, Task>, string?)
Registers a timed update that whenever the plugin is enabled calls the provided asyncAction at
the
provided
interval
public TimedUpdateRegistration AddTimedUpdate(TimeSpan interval, Func<double, Task> asyncAction, string? name = null)
Parameters
intervalTimeSpanThe interval at which the update should occur
asyncActionFunc<double, Task>The async action to call every time the interval has passed. The delta time parameter represents the time passed since the last update in seconds
namestringAn optional name used in exceptions and profiling
Returns
- TimedUpdateRegistration
The resulting plugin update registration
Disable()
Called when the feature is deactivated or when Artemis shuts down
public abstract void Disable()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the plugin feature and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Enable()
Called when the feature is activated
public abstract void Enable()
OnDisabled()
Triggers the Disabled event
protected virtual void OnDisabled()
OnEnabled()
Triggers the Enabled event
protected virtual void OnEnabled()
Events
Disabled
Occurs when the feature is disabled
public event EventHandler? Disabled
Event Type
Enabled
Occurs when the feature is enabled
public event EventHandler? Enabled