I have instantiated a class referenced in a C# assembly in managed C++. The C# class in the assembly has an event, and delegate defined like so:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, UseSynchronizationContext = false)]
public class BrowserWebServiceLite : IBrowserWebServiceLite
public static BrowserWebServiceLite instance;
private string jobPath;
public delegate void GetPageImageEventHandler( int buildPageNumber );
public event GetPageImageEventHandler GetPageImageEvent;
this.pageTemplates = new Collection<PixelPowerPageTemplate>();
I understand from the documentation that, in managed C++, if I wish to pass a non-static function to this delegate as a handler function, I do thus:
dele = gcnew BrowserWebServiceLite::BrowserWebServiceLite::GetPageImageEventHandler(this, &CPixelPowerControlCentreApp::OnGetPageImageEvent);
Where my referenced C# assembly is in the namespace 'BrowserWebServiceLite'.
I have successfully passed a static function by passing just the function reference (&), however it doesn't recognise this non-static form, and I need a non-static function.
I notice that all examples I have seen involve instantiating a delegate defined in managed C++ in the first place, but I don't know if this makes any difference. The documentation for this side of things seems very poor.