Page 1 of 3

EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 3:15 am
by Microsharp
Hi team

Is there a document we can look up all the delegate signatures?
Currently, we would like to know what EmailedEventHandler and EmailingEventHandler signatures are.
Please help. Thanks

Re: EmailedEventHandler and EmailingEventHandler signatures  Topic is solved

PostPosted: Mon Jun 27, 2022 9:58 am
by Scott.Pearce
Here's one way:

Load up VS and create a new project (I created a windows console .NET Framework 4.8 project).
Add a reference to JiwaApplication.dll (or whichever assembly contains the object/event you are interested in)
Instantiate the object (in this case it is the manager object that throws the EmailSendBefore event):
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Manager myManager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();

Now add a handler for the event you are interested in:
Code: Select all
myManager.EmailSendBefore += myManager_EmailSendBefore;

Note how the compiler is upset because you have not defined the handler yet:
UpsetCompiler.png

Now, hover the mouse pointer over the error (the text with the red squiggle under it) and choose "Show potential fixes" from the context menu:
Show pontential fixes.png

Select "Generate method ..." from the list:
Generate method.png

Now you have the signature information!
Signature.png


There are likely other ways, and these would vary via IDE.

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 11:45 am
by SBarnes
I usually just use a decompiler such as Just Decompile by Telerik which is free, the signatures are usually at the bottom of the relevant source files such as events in Sales Order are actually at the bottom of the Sales Order business logic class, you can also view them in visual basic or c#.

Using a decompiler also lets you see at what point events get called so for instance you can see what the difference is between an ending event and an end event for instance and also looking at a given method you can actually see if there is an appropriate event at all to hook onto to.

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 2:50 pm
by pricerc
SBarnes wrote:I usually just use a decompiler such as Just Decompile by Telerik which is free, the signatures are usually at the bottom of the relevant source files such as events in Sales Order are actually at the bottom of the Sales Order business logic class, you can also view them in visual basic or c#.

Using a decompiler also lets you see at what point events get called so for instance you can see what the difference is between an ending event and an end event for instance and also looking at a given method you can actually see if there is an appropriate event at all to hook onto to.


I have found that there is some parts of the Jiwa codebase (VB-based stuff, I think) that Telerik's decompiler just won't handle, regardless of what language you're decompiling to.

I have found that the open source ILSpy handles everything, although there is no option to decompile to VB (if that matters to you).

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 2:58 pm
by SBarnes
Redgate .net Reflector also handles the bits that Just Decompile won't and will decompile to either language but Just Decompile has the right price tag. :lol:

I've also used Just Decompile to convert a plugin such as the file watcher samples from vb.net to c# i.e. just find the compiled DLL that Jiwa deployed and open it, Just Decompile gets most of it right, it seems to struggle with indexers though.

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 5:04 pm
by Mike.Sheen
SBarnes wrote:I've also used Just Decompile to convert a plugin such as the file watcher samples from vb.net to c# i.e. just find the compiled DLL that Jiwa deployed and open it, Just Decompile gets most of it right, it seems to struggle with indexers though.


I'm fond of this Visual Studio extension to convert between C# and VB.NET: https://github.com/icsharpcode/CodeConverter

It lets you right click on a source file in the solution explorer and in the context menu you get a "Convert to C#" or "Convert to VB" option, which - as you would expect - performs a conversion.

You can use it for plugins by just pasting in the plugin code to a new code file and then converting that.

I was tinkering with adding a tool on the ribbon of plugin maintenance to convert plugins from c# to vb and vice-versa - the source code for icsharpcode/CodeConverter is licensed under the MIT License, which permits us to use that code in any way we like with no real restrictions.

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Mon Jun 27, 2022 5:37 pm
by SBarnes
I'm fond of this Visual Studio extension to convert between C# and VB.NET: https://github.com/icsharpcode/CodeConverter


I've played around with it also, I discovered it a couple of weeks back but it does not take well to say something like IReturn from ServiceStack in going from c# to Vb.net as it puts in inherits instead of Implements and Auto mapper code I had in the project confused the hell out of it.

Perhaps it would do a better job in turning vb.net into c# which is probably what it would get used for given a lot of the samples are vb.

It would be interesting to see how well it went with a big vb project/solution

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Wed Jun 29, 2022 5:08 pm
by pricerc
ILSpy is also developed by the icsharpcode team that does CodeConverter.

https://github.com/icsharpcode/ILSpy

Which makes one wonder why they don't have a decompile to VB option....

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Wed Jun 29, 2022 5:24 pm
by Mike.Sheen
pricerc wrote:Which makes one wonder why they don't have a decompile to VB option....


Ewww... why would anyone want to do THAT?

:P

Re: EmailedEventHandler and EmailingEventHandler signatures

PostPosted: Wed Jun 29, 2022 5:28 pm
by Scott.Pearce
I've been hanging out for COBOL support in Plugin Maintenance.