Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Delete any using (or Imports in VB) statements you are not using.

It is important to understand that some plugin classes are created and instantiated at logon time, and the same instance is used to invoke the methods within the class.

These classes are those implementing these interfaces:

  • IJiwaFormPlugin

  • IJiwaBusinessLogicPlugin

  • IJiwaApplicationManagerPlugin

  • IJiwaCustomFieldPlugin

  • IJiwaLineCustomFieldPlugin

  • IJiwaSystemSettingPlugin

  • IJiwaScheduledExecutionPlugin

So, as an example, consider the following code:

Code Block
languagec#
public class FormPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaFormPlugin
{
	public int Counter = 0;
	
    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
		Counter++;
    }

    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
		System.Windows.Forms.MessageBox.Show(Counter.ToString());
    }
}

And with the following Forms registered:

...

Each time the sales order form or quote form is loaded, a messagebox displays an incrementing number - illustrating that the variable Counter and hence the class is not created when the form is, but the same class instance is invoked when forms are loaded.

FormPlugin class

SetupBeforeHandlers

When a form is created via the FormFactory (as all forms in Jiwa are), if the form is registered on the Forms tab of the plugin, then the SetupBeforeHandlers method of the FormPlugin class is invoked after the form is created, but before the form has added any event handlers for the control or business logic.

...

Typically this is where custom controls are defined and added to the form, and where handlers to business logic or form control events are added.

BusinessLogic class

When a business logic object is created via the BusinessLogicFactory (as all business logic objects in Jiwa are), if the business logic is registered on the Business Logic tab of the plugin, then the Setup method of the BusinessLogicPlugin class is invoked after the business logic object is created.

...