Events

Jim <[email protected]> Fri, 16 Sep 2016 15:15:29 -0600
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Given this C# snippet:

classMainClass
{
publicstaticvoidMain(string[]args)
{
[...]
MessageReceiveNotifiermessageNotifier=[...]
messageNotifier.MessageReceived+=c_HostCommandMessageReceived;
[...]
}

staticvoidc_HostCommandMessageReceived(objectsender,MessageNotifierEventArgse)
{
//thestatuswillbe-1toindicateanunsolicitedmessage.
Console.WriteLine("TheHostCommandMessage{1}wasreceivedwithStatus{0}.",e.Status,e.Message);
[...]
}
}

I would expect that this in Java:

import cli.System.EventHandler;


public class MessageReceiveNotifier  {

     [...]

     public static void add_MessageReceived(EventHandler 
messageReceivedEventHandler) {
     }

     public static void remove_MessageReceived(EventHandler 
messageReceivedEventHandler) {

     }

}

Would meet the requirements of the line:

messageNotifier.MessageReceived+=c_HostCommandMessageReceived;

However MonoDevelop gives me the error:

Type 'MessageReceiveNotifier' does not contain a definition for 
'MessageReceived' and no extension method 'MessageReceived' of type 
'MessageReceiveNotifier' can be found.  Are you missing an assembly 
reference?

The Java class are in the same assembly and there is no complaint about 
MessageReceiveNotifier (and the MessageNotifierEventArgs class) so I 
think that the assemblies are all correct.

I have tried static and non-static for the add_ remove_ methods.

Help and ideas would be much appreciated?

Thanks,

Jim

-- 
Jim Redman
(505) 662 5156 x85
http://www.ergotech.com

------------------------------------------------------------------------------

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers