C# Class AppEventsSample.Helpers.DispatcherHelper

Helper class for dispatcher operations on the UI thread.
Datei anzeigen Open project: dkarzon/AppEvents

Public Methods

Method Description
Initialize ( ) : void

This method should be called once on the UI thread to ensure that the UIDispatcher property is initialized.

In a Silverlight application, call this method in the Application_Startup event handler, after the MainPage is constructed.

In WPF, call this method on the static App() constructor.

SafeDispatch ( System.Action action ) : void

Executes an action on the UI thread. If this method is called from the UI thread, the action is executed immendiately. If the method is called from another thread, the action will be enqueued on the UI thread's dispatcher and executed asynchronously.

For additional operations on the UI thread, you can get a reference to the UI thread's dispatcher thanks to the property UIDispatcher

.

Method Details

Initialize() public static method

This method should be called once on the UI thread to ensure that the UIDispatcher property is initialized.

In a Silverlight application, call this method in the Application_Startup event handler, after the MainPage is constructed.

In WPF, call this method on the static App() constructor.

public static Initialize ( ) : void
return void

SafeDispatch() public static method

Executes an action on the UI thread. If this method is called from the UI thread, the action is executed immendiately. If the method is called from another thread, the action will be enqueued on the UI thread's dispatcher and executed asynchronously.

For additional operations on the UI thread, you can get a reference to the UI thread's dispatcher thanks to the property UIDispatcher

.
public static SafeDispatch ( System.Action action ) : void
action System.Action The action that will be executed on the UI /// thread.
return void