Class Dispatcher
- Namespace
- nanoFramework.UI.Threading
- Assembly
- nanoFramework.Graphics.dll
Provides UI services for a thread.
public sealed class Dispatcher
- Inheritance
-
Dispatcher
- Inherited Members
- Extension Methods
Properties
CurrentDispatcher
Returns the Dispatcher for the current thread.
public static Dispatcher CurrentDispatcher { get; }
Property Value
- Dispatcher
Dispatcher
HasShutdownFinished
Whether or not the dispatcher has been shut down.
public bool HasShutdownFinished { get; }
Property Value
HasShutdownStarted
Whether or not the dispatcher is shutting down.
public bool HasShutdownStarted { get; }
Property Value
Thread
Thread for the dispatcher.
public Thread Thread { get; }
Property Value
Methods
BeginInvoke(DispatcherOperationCallback, object)
Executes the specified delegate asynchronously with the specified arguments, on the thread that the Dispatcher was created on.
public DispatcherOperation BeginInvoke(DispatcherOperationCallback method, object args)
Parameters
method
DispatcherOperationCallbackA delegate to a method that takes parameters of the same number and type that are contained in the args parameter.
args
objectAn object to pass as the argument to the given method. This can be null if no arguments are needed.
Returns
- 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.
public bool CheckAccess()
Returns
- 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.
public static Dispatcher FromThread(Thread thread)
Parameters
thread
Thread
Returns
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.
public object Invoke(TimeSpan timeout, DispatcherOperationCallback method, object args)
Parameters
timeout
TimeSpanThe maximum amount of time to wait for the operation to complete.
method
DispatcherOperationCallbackA delegate to a method that takes parameters of the same number and type that are contained in the args parameter.
args
objectAn object to pass as the argument to the given method. This can be null if no arguments are needed.
Returns
- 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.
public void InvokeShutdown()
PushFrame(DispatcherFrame)
Push an execution frame.
public static void PushFrame(DispatcherFrame frame)
Parameters
frame
DispatcherFrameThe frame for the dispatcher to process.
Run()
Push the main execution frame.
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.
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.
public event EventHandler ShutdownFinished
Event Type
ShutdownStarted
Raised when the dispatcher starts shutting down.
public event EventHandler ShutdownStarted