C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Public Static Functions | Properties
UiDispatcher Class Reference

The UiDispatcher class defines a platform-independent API for invoking actions on the system's UI thread.

Public Functions

delegate bool CheckEventArgsCallback< in T > (object sender, T eventArgs)
 

Public Static Functions

static void BeginInvoke (Action action)
 
static void BeginInvoke (Delegate del, params object[] args)
 
static void BeginInvoke (this DependencyObject d, Action action)
 
static bool CheckAccess ()
 
static void Fire (this PropertyChangedEventHandler eventHandler, object sender, PropertyChangedEventArgs eventArgs)
 
static void Fire (this EventHandler eventHandler, object sender, EventArgs eventArgs)
 
static void Fire< T > (this EventHandler< T > eventHandler, object sender, T eventArgs)
 
static void Fire< T > (this EventHandler< T > eventHandler, object sender, T eventArgs, CheckEventArgsCallback< T > callback, Signal completion)
 
static void Invoke (Action action)
 
static void Invoke (Delegate del, params object[] args)
 
static void Invoke (this DependencyObject d, Action action)
 
static void VerifyAccess ()
 

Properties

static Dispatcher Dispatcher [get, set]
 
static bool HasDispatcher [get]
 

Usage Description

static void BeginInvoke ( Action  action)
inlinestatic

Invokes the specified action asynchronously on the UI thread.

Parameters
actionThe action to invoke.
static void BeginInvoke ( Delegate  del,
params object[]  args 
)
inlinestatic

Invokes the specified action asynchronously on the UI thread.

Parameters
delThe delegate.
argsThe arguments.
static void BeginInvoke ( this DependencyObject  d,
Action  action 
)
inlinestatic

Invokes the action on the specified dependency object's dispatcher thread. Does not wait for the action to complete if the current thread is not the dependency object's dispatcher thread.

Parameters
dThe dependency object.
actionThe action to invoke.
static bool CheckAccess ( )
inlinestatic

Returns a Boolean value that indicates whether the current thread is the UI thread. Will return true if it is, or false otherwise.

delegate bool CheckEventArgsCallback< in T > ( object  sender,
eventArgs 
)

Defines a callback for checking event args after an event handler has been called.

Template Parameters
T
Parameters
senderThe sender.
eventArgsThe event args.
Returns
True if further event handlers should be called.
Type Constraints
T :EventArgs 
static void Fire ( this PropertyChangedEventHandler  eventHandler,
object  sender,
PropertyChangedEventArgs  eventArgs 
)
inlinestatic

Helper to fire an event asynchronously on the UI thread. Fires each handler in the event's invocation list.

Parameters
eventHandlerThe event handler.
senderThe sender.
eventArgsThe System.EventArgs instance containing the event data.
static void Fire ( this EventHandler  eventHandler,
object  sender,
EventArgs  eventArgs 
)
inlinestatic

Helper to fire an event asynchronously on the UI thread. Fires each handler in the event's invocation list.

Parameters
eventHandlerThe event handler.
senderThe sender.
eventArgsThe System.EventArgs instance containing the event data.
static void Fire< T > ( this EventHandler< T >  eventHandler,
object  sender,
eventArgs 
)
inlinestatic

Helper to fire an event asynchronously on the UI thread. Fires each handler in the event's invocation list.

Parameters
eventHandlerThe event handler.
senderThe sender.
eventArgsThe System.EventArgs instance containing the event data.
Type Constraints
T :EventArgs 
static void Fire< T > ( this EventHandler< T >  eventHandler,
object  sender,
eventArgs,
CheckEventArgsCallback< T >  callback,
Signal  completion 
)
inlinestatic

Helper to fire an event asynchronously on the UI thread. Fires each handler in the event's invocation list. After each handler is invoked, the callback is invoked on the UI thread.

Template Parameters
T
Parameters
eventHandlerThe event handler.
senderThe sender.
eventArgsThe System.EventArgs instance containing the event data.
callbackThe callback.
completionThe completion signal, set when notifications are complete. May be null.
Type Constraints
T :EventArgs 
static void Invoke ( Action  action)
inlinestatic

Invokes the action on the UI thread. Does not return until the action is complete. Rethrows any exceptions thrown by the action.

Parameters
actionThe action to invoke.
static void Invoke ( Delegate  del,
params object[]  args 
)
inlinestatic

Invokes the delegate on the UI thread. Does not return until the delgate is complete. Rethrows any exceptions thrown by the action.

Parameters
delThe delegate.
argsThe arguments.
static void Invoke ( this DependencyObject  d,
Action  action 
)
inlinestatic

Invokes the action on the specified dependency object's dispatcher thread. Does not return until the action is complete. Rethrows any exceptions thrown by the action.

Parameters
dThe dependency object.
actionThe action to invoke.
static void VerifyAccess ( )
inlinestatic

Verifies that the current thread is the UI thread.

Property Documentation

Dispatcher Dispatcher
staticgetset

Gets or sets the dispatcher used by the class.

bool HasDispatcher
staticget

Gets a value indicating whether a dispatcher.