Form Plugin Setup  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Form Plugin Setup

Postby SBarnes » Mon May 07, 2018 11:23 am

Hi Mike,

Is these a way to make the Form Plugin Setup be called for every form that is created, without every form that is in SY_Forms being added as a form reference?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Form Plugin Setup  Topic is solved

Postby Mike.Sheen » Mon May 07, 2018 8:46 pm

Hi Stuart,

You can add a handler within the Setup method of the ApplicationManagerPlugin for the FormFactory AfterFormStart event.

In 07.00.175.00 this would be:

Code: Select all
public class ApplicationManagerPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaApplicationManagerPlugin
{

    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.FormFactory.AfterFormStart += AfterFormStart;
    }
   
   public void AfterFormStart(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm)
   {
      // code goes in here to handle after the form has started (equivalent to Setup method)            
   }
}


In 07.01.xx:
Code: Select all
public class ApplicationManagerPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaApplicationManagerPlugin
{

    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
        Plugin.Manager.FormFactory.AfterFormStart += AfterFormStart;
    }
   
   public void AfterFormStart(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm)
   {
      // code goes in here to handle after the form has started (equivalent to Setup method)            
   }
}


Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Form Plugin Setup

Postby SBarnes » Fri May 11, 2018 5:59 pm

Hi Mike,

Thanks for the reply.

A minor little issue that I have just discovered in 7.1, is that if you have a custom form in a plugin, and you add that form to the form references references for the same plugin so you can put code into the Form Plugin Setup, this all works fine but when you export the plugin and try and import it you of course get a plugin error about the form not found and the import fails, you have to remove the reference, export, import and add the reference back to get around it. I only mention it in case someone else comes across the same issue.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Form Plugin Setup

Postby Mike.Sheen » Sat May 12, 2018 2:55 pm

Hi Stuart,

Thanks - logged as DEV-6613. An edge case we hadn't considered - not sure if we can fix it, but we'll see.

A workaround might be to split the plugin in two - one which creates the form, and a second which has a plugin reference to the plugin defining the form and with an execution order higher than the plugin defining the form. This would mean you'd have to make sure you import the plugins in order - not sure if that's less of a burden than how you're currently working around it or not.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 18 guests

cron