DelegateTask..::..CallBack delegate that is called in IDispatcher thread. Usually used in synchronization with GUI thread.
Namespace: Dapfor.Wpf.ThreadingAssembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)
Syntax
C# |
---|
public delegate void CallBack() |
Visual Basic |
---|
Public Delegate Sub CallBack |
Visual C++ |
---|
public delegate void CallBack() |
F# |
---|
type CallBack = delegate of unit -> unit |
Remarks
Following example demonstrates how to synchronize threads via anonymous method
Copy | |
---|---|
private void WriteDataToConsole(object data) { if (dispatcher.SynchronizationRequired) { //Create a task that will be executed in dispatcher thread without blocking the calling thread dispatcher.Dispatch(new DelegateTask(delegate { Console.WriteLine("Called in the anonymous method: object = {0}", data); })); } else { Console.WriteLine("No synchronization required: object = {0}", data); } } |