Translating EventAggregators usage of SynchronizationContext to VB.Net
- by Phil Sayers
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.