Translating EventAggregators usage of SynchronizationContext to VB.Net

Posted by Phil Sayers on Stack Overflow See other posts from Stack Overflow or by Phil Sayers
Published on 2010-05-19T15:08:46Z Indexed on 2010/05/19 15:10 UTC
Read the original article Hit count: 925

Working with a fairly large VB.Net back office winforms application. 1 million+ LOC. Big ball of mud, 90% of all code is in Forms & other UI controls.

Slowly introducing better architecture as time & recources allows, We've been using ideas from the EventAggrgator by Jeremy Miller.

http://codebetter.com/blogs/jeremy.miller/archive/2008/01/11/build-your-own-cab-extensible-pub-sub-event-aggregator-with-generics.aspx

Initially I stripped out the usage of SynchronizationContext. Now I'm trying to introduce it back, and I'm struggling with the translation of the lamda stuff from c# to vb.net.

Specifically this line of c#

_context.Send(delegate { receiver.Handle(subject); }, null);

This is the vb.net I have so far:

_context.Send(New SendOrPostCallback(AddressOf listener.Handle(message)), Nothing)

The error I'm getting is

listener.Handle(message) <-- AddressOf operand must be the name of a method.

I'm sure I'm missing something simple, but after staring at this for 2 days, I'm lost.

© Stack Overflow or respective owner

Related posts about c#-to-vb.net

Related posts about eventaggregator