ThreadOption UserInterface doesnt work.

Topics: Mobile Client Software Factory
Aug 29, 2006 at 1:40 AM
originally posted by: david3001

Hi all,

When I subscribe to an event with EventSubscription("topic://...",Thread=ThreadOption.UserInface"), the event is not caught in the UI Thread. I took a look at the implementation and found out, that there si no difference between ThreadOption Publisher and UserInterface because SynchronizationContext is not available on .NET CF2.0. Is there a workaround for this problem?

Thanks,
DAvid
Aug 29, 2006 at 2:20 AM
originally posted by: david3001

Hi all,

I found a - not very nice - workaround. In my presenter (where the event is caught), I instanciate a Button (System.Windows.Forms) and say

if (uiButton.InvokeRequired)
{
uiButton.Invoke(new UIThreadDelegate(MethodName), new object[] { param1,param2 });
}
else
{
// do your stuff on the UI Thread
}

This is my workaround... not very nice, but it works!

hth,
david
Aug 29, 2006 at 2:58 AM
originally posted by: dcazzulino

Nice trick!
BTW, that most probably means you can modify the event broker implementation to use the same trick to marshall the calls...