design - C++/CLI - Managed class to C# events -


I have a C ++ class, which triggers some method like an event.

  class Blah {virtual zero event (EventArgs e); }   

Whenever the method is called the C # (managed) event, how do I wrap it?

I thought about inheriting the class and overloading the event method, and then call somehow managed event. I'm not sure how to do it really.

something like that (now compile-testing):

  #include & Lt; Vcclr.h & gt; Structure blah_args {int x, y; }; Straight blah {virtual zero phenomenon (const blma_argue and a) = 0; }; Public Ref: BlahEventArgs: public systems :: EventArgs {public: int x, y; }; Public Ref: BlahDotNet {Public: Event System :: Event Handler & lt; BlahEventArgs ^> ^ This happened; Internal: Zero-lifting (BlaEventErgues ^ E) {It happened (it, E); }}; Square blah_event_forwarder: public blah {gcroot & lt; BlahDotNet ^ & gt; M_managed; Public: blah_event_forwarder (BlahDotNet ^ Managed): m_managed (managed) {} ​​Protected: Virtual zero event (Const Blah_arges & amp; E) {BlahEventArgs ^ e2 = gcnew BlahEventArgs (); E2-> X = e.x; E2-> gt; Y = e.y; M_managed-> RaiseItHappened (E2); }};    

Comments