Re: Events

Jim <[email protected]> Sat, 17 Sep 2016 10:37:32 -0600
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Jeroen,

Thanks,  reading this:

https://sourceforge.net/p/ikvm/mailman/message/4229204/

I was hoping that the definitions would work.

Any suggested work-around?  For whatever reason, we have a customer who 
can load IKVM dlls and any dlls we create using IKVM, but not the VS 
generated DLL.

There is some claim of requiring .NET 2.0 compatibility but is IKVM 
limited to the 2.0 API?

Thanks,

Jim



On 09/17/2016 02:12 AM, Jeroen Frijters wrote:
> Hi Jim,
>
> There's no support for defining events from the Java side.
>
> Regards,
> Jeroen
>
>> -----Original Message-----
>> From: Jim [mailto:[email protected]]
>> Sent: Friday, September 16, 2016 23:15
>> To: [email protected]
>> Subject: [Ikvm-developers] Events
>>
>> Given this C# snippet:
>>
>>      class MainClass
>>      {
>>          public static void Main (string[] args)
>>          {
>>              [...]
>>              MessageReceiveNotifier messageNotifier = [...]
>>              messageNotifier.MessageReceived +=
>> c_HostCommandMessageReceived;
>>              [...]
>>          }
>>
>>          static void c_HostCommandMessageReceived (object sender,
>> MessageNotifierEventArgs e)
>>          {
>>              // the status will be -1 to indicate an unsolicited message.
>>              Console.WriteLine ("The Host Command Message {1} was
>> received with Status {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

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


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