locked
C# and C++ interop and Events RRS feed

  • Question

  • I have a thin C# XAML UI sitting on top of a large C++/Direct3D core. The C++ core fires off long running threads that occasionally poll for data from the internet. When they receive new data, I'd like for the C++ thread to trigger an event for the C# UI. I've read through some of the interop docs but it was never clear to me which thread is used in the C# event handler. Is it the C++ thread that triggered the event or is it the main C# UI thread?

    The C# event handler will query the new data from the C++ component then modify the XAML UI, so the event handler needs to be capable of touching XAML elements cleanly. Right now I use a one second DispatcherTimer in C# that polls the C++ component to see if anything new has arrived. It works but is wasteful.

    Thanks


    • Edited by henador Saturday, January 26, 2013 4:06 PM
    Saturday, January 26, 2013 3:54 PM