Page 1 of 1

Embedded Form Launch

PostPosted: Sun Apr 18, 2021 9:20 am
by SBarnes
I have a situation where I need to embed a form in a class library to protect the code for security reasons to do with access to an external system but I then want launch the form from the menu system.

I realize I can register the form from the DLL instead of a standard plugin but would prefer to do this from a plugin so that it makes deployment easier is there a way to do this as when I tried Jiwa reported an error about not finding the form in the assembly which given the name was a guid, this I would assume is the assembly for the plugin?

I've tried making sure the embedded assembly was loaded to see if that helped but it made no difference.

Re: Embedded Form Launch  Topic is solved

PostPosted: Sun Apr 18, 2021 2:38 pm
by Mike.Sheen
When you launch a form (the FormFactory creates it), we look in the SY_forms table - if it's FormType is 1, then we use the AssemblyFullName to load the assembly and then create an instance of the ClassName.

When the FormType is 2, we treat the AssemblyFullName as the Plugin.RecID - so we find in the loaded plugins the plugin matching the RecID and then create an instance of the ClassName from it's assembly.

We don't support an embedded assembly reference containing the form.

You might be able to fool the system by having the FormType as 1 in SY_Forms and setting the AssemblyFullName being the assembly full name of your embedded reference ("MyEmbeddedReference, Version=1.0, Culture=neutral, PublicKeyToken=null" or whatever) - the AssemblyResolver might need to be handled, however - so that it can be directed to the right folder to find the assembly. We have a RuntimeFolder property of the plugin, so that's how you know which folder to find the embedded reference assembly.

My gut feeling is you probably could make it work, but I can't say for sure without trying it myself.