Table of Contents

Class Dispatcher

Namespace
Icy.Data.Markup
Assembly
IcyUI.dll

Represents a class that provides a functionality for completing calls from multiple threads synchronously.

public class Dispatcher
Inheritance
Dispatcher
Inherited Members
Extension Methods

Properties

DispatchedAmount

Gets or sets the amount of actions that can be performed per one update call.

public int DispatchedAmount { get; set; }

Property Value

int

Thread

Gets the thread on which the dispatcher was made.

public Thread Thread { get; }

Property Value

Thread

Methods

Cancel()

Cancels all remaining actions before their execution.

public void Cancel()

CheckAccess()

Checks if the dispatcher can be accessed with the current thread.

public bool CheckAccess()

Returns

bool

true if a dispatcher is accessible with current thread; false otherwise.

GetCurrentThreadDispatcher()

Gets the dispatcher for the current thread if available, otherwise creates the new one.

public static Dispatcher GetCurrentThreadDispatcher()

Returns

Dispatcher

The dispatcher for the current thread.

Invoke(Action, DispatcherPriority)

Adds an action to the synchronous queue.

public void Invoke(Action action, DispatcherPriority priority = DispatcherPriority.Normal)

Parameters

action Action

An action to complete synchronously.

priority DispatcherPriority

The priority for an action to complete.

RegisterAnimation(Animation)

Registers an animation to have Update(TimeSpan) called once per frame by UpdateAnimations(TimeSpan).

public void RegisterAnimation(Animation animation)

Parameters

animation Animation

The animation to tick every frame.

Remarks

Called by Start() - call UnregisterAnimation(Animation) once the animation stops or completes.

RegisterFrameBinding(IBinding)

Registers a binding to have UpdateTarget() called once per frame by UpdateFrameBindings(), regardless of whether its source raises change notifications.

public void RegisterFrameBinding(IBinding binding)

Parameters

binding IBinding

The binding to poll every frame.

Remarks

Intended for EveryFrame bindings — call UnregisterFrameBinding(IBinding) once the binding is disposed or switches away from that trigger.

Reset()

Clears the dispatcher by calling all remaining actions.

public void Reset()

UnregisterAnimation(Animation)

Stops calling Update(TimeSpan) once per frame for an animation previously passed to RegisterAnimation(Animation).

public void UnregisterAnimation(Animation animation)

Parameters

animation Animation

The animation to stop ticking.

UnregisterFrameBinding(IBinding)

Stops calling UpdateTarget() once per frame for a binding previously passed to RegisterFrameBinding(IBinding).

public void UnregisterFrameBinding(IBinding binding)

Parameters

binding IBinding

The binding to stop polling.

Update()

Updates the dispatcher, calls the first actions in the queue and stops the rendering until they're ended.

public void Update()

Update(DispatcherPriority)

Updated the dispatcher, calls the first actions in the queue with priorities more or equal to given.

public void Update(DispatcherPriority priority)

Parameters

priority DispatcherPriority

The maximal priority to execute operations with.

UpdateAnimations(TimeSpan)

Calls Update(TimeSpan) once for every animation registered through RegisterAnimation(Animation), advancing it by delta.

public void UpdateAnimations(TimeSpan delta)

Parameters

delta TimeSpan

The amount of time to advance every running animation by.

Remarks

Called once per frame from Render(), alongside Update(DispatcherPriority) for DataBind and UpdateFrameBindings(), so animations advance at the same point in the frame as reactive and frame-driven bindings. Registered frame tickers are advanced after the animations.

UpdateFrameBindings()

Calls UpdateTarget() once for every binding registered through RegisterFrameBinding(IBinding).

public void UpdateFrameBindings()

Remarks

Called once per frame from Render(), alongside Update(DispatcherPriority) for DataBind, so EveryFrame bindings refresh at the same point in the frame as reactive ones.

VerifyAccess()

Determines whether the current thread can access this Dispatcher instance.

public void VerifyAccess()