Class StaSynchronizationContext
A synchronization context running in a STA thread.
Implements
Namespace: Sartorius.SAF.Threading
Assembly: Sartorius.SAF.dll
Syntax
public sealed class StaSynchronizationContext : SynchronizationContext, IDisposable
Remarks
The DispatcherSynchronizationContext makes problems in .NET Core (some issues with loading the DispatcherFrame from WindowsBase).
Methods
View SourceCreateCopy()
When overridden in a derived class, creates a copy of the synchronization context.
Declaration
public override SynchronizationContext CreateCopy()
Returns
| Type | Description |
|---|---|
| SynchronizationContext | A new SynchronizationContext object. |
Overrides
View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Post(SendOrPostCallback, object)
When overridden in a derived class, dispatches an asynchronous message to a synchronization context.
Declaration
public override void Post(SendOrPostCallback d, object state)
Parameters
| Type | Name | Description |
|---|---|---|
| SendOrPostCallback | d | The SendOrPostCallback delegate to call. |
| object | state | The object passed to the delegate. |
Overrides
View SourceRun()
Starts processing the queue. This method will run until the StaSynchronizationContext is disposed.
Declaration
public void Run()
Send(SendOrPostCallback, object)
When overridden in a derived class, dispatches a synchronous message to a synchronization context.
Declaration
public override void Send(SendOrPostCallback d, object state)
Parameters
| Type | Name | Description |
|---|---|---|
| SendOrPostCallback | d | The SendOrPostCallback delegate to call. |
| object | state | The object passed to the delegate. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The method was called in a Windows Store app. The implementation of SynchronizationContext for Windows Store apps does not support the Send(SendOrPostCallback, object) method. |
StartNew()
Creates a new STA thread and starts processing the queue.
Declaration
public static StaSynchronizationContext StartNew()
Returns
| Type | Description |
|---|---|
| StaSynchronizationContext |