Class Dispatcher
Provides services for managing the queue of work items for a thread.
Inheritance
Inherited Members
Namespace: System.Windows.Threading
Assembly: OpenSilver.dll
Syntax
public sealed class Dispatcher
Properties
| Improve this Doc View SourceCurrentDispatcher
Gets the Dispatcher for the thread currently executing and creates a new Dispatcher if one is not already associated with the thread.
Declaration
public static Dispatcher CurrentDispatcher { get; }
Property Value
Type | Description |
---|---|
Dispatcher | The dispatcher associated with the current thread. |
Methods
| Improve this Doc View SourceBeginInvoke(Action)
Executes the specified delegate asynchronously on the thread the Dispatcher is associated with.
Declaration
public DispatcherOperation BeginInvoke(Action a)
Parameters
Type | Name | Description |
---|---|---|
System.Action | a | A delegate to a method that takes no arguments and does not return a value, which is pushed onto the Dispatcher event queue. |
Returns
Type | Description |
---|---|
DispatcherOperation | An object, which is returned immediately after BeginInvoke(Action) is called, that represents the operation that has been posted to the Dispatcher queue. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
BeginInvoke(Delegate, Object[])
Executes the specified delegate asynchronously with the specified array of arguments on the thread the Dispatcher is associated with.
Declaration
public DispatcherOperation BeginInvoke(Delegate d, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Delegate | d | A delegate to a method that takes multiple arguments, which is pushed onto the Dispatcher event queue. |
System.Object[] | args | An array of objects to pass as arguments to the specified method. |
Returns
Type | Description |
---|---|
DispatcherOperation | An object, which is returned immediately after BeginInvoke(Delegate, Object[]) is called, that represents the operation that has been posted to the Dispatcher queue. |
CheckAccess()
Determines whether the calling thread is the thread associated with this Dispatcher.
Declaration
public bool CheckAccess()
Returns
Type | Description |
---|---|
System.Boolean | true if the calling thread is the thread associated with this Dispatcher; otherwise, false. |
DisableProcessing()
Disables processing of the Dispatcher queue.
Declaration
public DispatcherProcessingDisabled DisableProcessing()
Returns
Type | Description |
---|---|
DispatcherProcessingDisabled | A structure used to re-enable dispatcher processing. |
InvokeAsync(Action, DispatcherPriority)
Executes the specified System.Action asynchronously at the specified priority on the thread the Dispatcher is associated with.
Declaration
public DispatcherOperation InvokeAsync(Action a, DispatcherPriority priority = DispatcherPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.Action | a | A delegate to invoke through the dispatcher. |
DispatcherPriority | priority | The priority that determines the order in which the specified callback is invoked relative to the other pending operations in the Dispatcher. |
Returns
Type | Description |
---|---|
DispatcherOperation | An object, which is returned immediately after InvokeAsync(Action, DispatcherPriority) is called, that can be used to interact with the delegate as it is pending execution in the event queue. |