Class Dispatcher
Provides UI services for a thread.
Inherited Members
Namespace: nanoFramework.UI.Threading
Assembly: nanoFramework.Graphics.dll
Syntax
public sealed class Dispatcher
Properties
CurrentDispatcher
Returns the Dispatcher for the current thread.
Declaration
public static Dispatcher CurrentDispatcher { get; }
Property Value
Type | Description |
---|---|
Dispatcher | Dispatcher |
HasShutdownFinished
Whether or not the dispatcher has been shut down.
Declaration
public bool HasShutdownFinished { get; }
Property Value
Type | Description |
---|---|
bool |
HasShutdownStarted
Whether or not the dispatcher is shutting down.
Declaration
public bool HasShutdownStarted { get; }
Property Value
Type | Description |
---|---|
bool |
Thread
Thread for the dispatcher.
Declaration
public Thread Thread { get; }
Property Value
Type | Description |
---|---|
Thread |
Methods
BeginInvoke(DispatcherOperationCallback, object)
Executes the specified delegate asynchronously with the specified arguments, on the thread that the Dispatcher was created on.
Declaration
public DispatcherOperation BeginInvoke(DispatcherOperationCallback method, object args)
Parameters
Type | Name | Description |
---|---|---|
DispatcherOperationCallback | method | A delegate to a method that takes parameters of the same number and type that are contained in the args parameter. |
object | args | An object to pass as the argument to the given method. This can be null if no arguments are needed. |
Returns
Type | Description |
---|---|
DispatcherOperation | A DispatcherOperation object that represents the result of the BeginInvoke operation. null if the operation could not be queued. |
CheckAccess()
Checks that the calling thread has access to this object.
Declaration
public bool CheckAccess()
Returns
Type | Description |
---|---|
bool | True if the calling thread has access to this object. |
Remarks
Only the dispatcher thread may access DispatcherObjects.
This method is public so that any thread can probe to see if it has access to the DispatcherObject.FromThread(Thread)
Returns the Dispatcher for the specified thread.
Declaration
public static Dispatcher FromThread(Thread thread)
Parameters
Type | Name | Description |
---|---|---|
Thread | thread |
Returns
Type | Description |
---|---|
Dispatcher |
Remarks
If there is no dispatcher available for the specified thread, this method will return null.
Invoke(TimeSpan, DispatcherOperationCallback, object)
Executes the specified delegate synchronously with the specified arguments, on the thread that the Dispatcher was created on.
Declaration
public object Invoke(TimeSpan timeout, DispatcherOperationCallback method, object args)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The maximum amount of time to wait for the operation to complete. |
DispatcherOperationCallback | method | A delegate to a method that takes parameters of the same number and type that are contained in the args parameter. |
object | args | An object to pass as the argument to the given method. This can be null if no arguments are needed. |
Returns
Type | Description |
---|---|
object | The return value from the delegate being invoked, or null if the delegate has no return value or if the operation was aborted. |
InvokeShutdown()
Begins the process of shutting down the dispatcher, synchronously. The process may complete asynchronously, since we may be nested in dispatcher frames.
Declaration
public void InvokeShutdown()
PushFrame(DispatcherFrame)
Push an execution frame.
Declaration
public static void PushFrame(DispatcherFrame frame)
Parameters
Type | Name | Description |
---|---|---|
DispatcherFrame | frame | The frame for the dispatcher to process. |
Run()
Push the main execution frame.
Declaration
public static void Run()
Remarks
This frame will continue until the dispatcher is shut down.
VerifyAccess()
Verifies that the calling thread has access to this object.
Declaration
public void VerifyAccess()
Remarks
Only the dispatcher thread may access DispatcherObjects.
This method is public so that derived classes can probe to see if the calling thread has access to itself.Events
ShutdownFinished
Raised when the dispatcher is shut down.
Declaration
public event EventHandler ShutdownFinished
Event Type
Type | Description |
---|---|
EventHandler |
ShutdownStarted
Raised when the dispatcher starts shutting down.
Declaration
public event EventHandler ShutdownStarted
Event Type
Type | Description |
---|---|
EventHandler |