[Mono-list] Mono Embedding: manage events
David Perfors
dnperfors at gmail.com
Wed Apr 2 03:20:51 EDT 2008
Although I don't have any experience with this, another solution could
be to first create a wrapper class in C# which can talk to the C++
class in the correct way. Ok it takes more time to write, but you are
more flexible.
David
On Wed, Apr 2, 2008 at 9:12 AM, Ing. Francesco Carsana
<francescocarsana at ds4.it> wrote:
> > The recommended way is to declare the handlers as icalls in
> > managed code:
>
> The problem is that I can't modify .NET assembly source code.
> I only know that assembly has this event:
>
> public event ConnectionEventHandler OnConnectionEvent;
>
> where ConnectionEventHandler is:
>
> public delegate void ConnectionEventHandler(string n, bool c);
>
> To manage that event in C#:
>
> s = new Session();
> s.OnConnectionEvent += new
> ConnectionEventHandler(s_OnConnectionEvent); // Attach to receive Event
>
> where s_OnConnectionEvent is:
>
> void s_OnConnectionEvent(string n, bool b)
> {
> ...
> }
>
> In my C++ wrapper class to this assembly, I have to find a way
> to pass a function pointer (or something else) to the assembly in
> order to manage that event. Is it possible?
> Is there another way to do that?
> Could someone please give me an example, please?
>
> Thank You.
>
> Francesco.
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
More information about the Mono-list
mailing list