Thread Safe Event Dispatching in WPF

Recently I have been using a quite a bit of C# WPF on the projects I am developing because it provides for very flexible and quick user interface design and implementation. The learning curve for a traditional (C/C++) software developer may be steep, but once the basics are understood it is pretty easy to use as a development tool.

Since I develop applications that use external hardware (ex. Camera) I have to place some of the logic in threads in order not to block the user interface while an action is performed. After the action completes I need to pass the message back to the user interface. Unfortunately WPF user interface breaks if a user interface event is instantiated from a thread. Because of this I have created a class extender for EventHandler that makes thread instantiated events possible.

Following is an abstract usage:

To see the code in action download the sample project: