Skip to content

Class ContextUpdateTracker

Definition

Namespace: StardewUI.Framework.Binding
Assembly: StardewUI.dll

Tracks context instances that already had updates dispatched this frame, to prevent duplication.

public class ContextUpdateTracker

Inheritance
Object ⇦ ContextUpdateTracker

Remarks

Used by the ContextUpdatingNodeDecorator.

Members

Fields

Name Description
Instance Global instance for entire framework.

Methods

Name Description
Reset() Resets all state; to be called at the beginning of each frame.
TrackUpdate(Object) Tracks the update of a context instance so that WasAlreadyUpdated(Object) returns true for the given contextData until Reset() is called.
WasAlreadyUpdated(Object) Checks if a context instance already received an update tick dispatch for the current frame.

Details

Fields

Instance

Global instance for entire framework.

public static readonly StardewUI.Framework.Binding.ContextUpdateTracker Instance;
Field Value

ContextUpdateTracker

Remarks

Entire view trees may share the same context data; this is entirely up to the client(s). Therefore, the same tracker instance must be shared by all nodes in order to prevent duplication.

The instance is expected to be reset in the ModEntry or similar entry point.


Methods

Reset()

Resets all state; to be called at the beginning of each frame.

public void Reset();

TrackUpdate(Object)

Tracks the update of a context instance so that WasAlreadyUpdated(Object) returns true for the given contextData until Reset() is called.

public void TrackUpdate(System.Object contextData);
Parameters

contextData   Object
The context that was updated.


WasAlreadyUpdated(Object)

Checks if a context instance already received an update tick dispatch for the current frame.

public bool WasAlreadyUpdated(System.Object contextData);
Parameters

contextData   Object
The context that may have been previously updated.

Returns

Boolean

true if the contextData already received an update tick, otherwise false.