Table of Contents

Class SynchronizationContextBindingScheduler

Namespace
SodaFlow.Bindable.ObjectModel
Assembly
SodaFlow.Core.Bindable.ObjectModel.dll

Posts through a captured SynchronizationContext. This works with no change for WPF, which uses DispatcherSynchronizationContext, and for Avalonia, which uses AvaloniaSynchronizationContext. The SynchronizationContext must run items one at a time and not in parallel. Its Post() method must not run the SendOrPostCallback delegate directly, because that makes this scheduler re-entrant.

[PublicAPI]
public sealed class SynchronizationContextBindingScheduler : IBindingScheduler
Inheritance
SynchronizationContextBindingScheduler
Implements
Inherited Members
Extension Methods

Remarks

All the actions that one transaction posts go to the context as one item, in the sequence of the posts. Thus, the binding thread gets all the changes of a transaction in one turn of its message loop, and no other work runs between them. A control that gets two related values, such as a list and its selected item, can then apply the two together.

An action that SodaFlow posts while no transaction is open goes to the context as an item of its own.

Constructors

SynchronizationContextBindingScheduler(SynchronizationContext)

Creates an instance that posts through the given synchronization context.

Methods

Capture()

Captures the synchronization context of the current thread.

CheckAccess()

Whether the calling thread is the one this scheduler posts to.

Post(Action)

Posts through the captured context.