Versions Compared

Key

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

...

A plugin with an Abort Exception Policy will not allow processes (such as the REST API or Plugin Scheduler) to logon if the plugin is unable to be loaded.

Execution Order

Plugins are compiled and loaded in the order of Execution Order, then plugin Name.

If you add a Plugin Reference (a reference to another plugin) then the Execution Order is automatically set to the Execution Order of the referenced plugin, incremented by one.

Forms

The Forms tab of the plugin is a register of forms that, when loaded will result in the SetupBeforeHandlers and Setup methods of the FormPlugin class being invoked.

...

You should only add forms to this list which your plugin has an interest in.

Code

FormPlugin

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.

...

The SetupBeforeHandlers method can be used to add handlers to control events and business logic before the form itself handles these events.

This is often useful in overriding the built-in behaviour - for example, adding a button click handler here will cause your code to respond to the event before the form does, and you can also short-circuit the event so the form doesn’t receive the event at all afterwards by throwing a JiwaApplication.Exceptions.ClientCancelledException which will silently fail, resulting in your plugin handling the event and the form not handling it with its built-in handler.

The JiwaForm parameter passed to the SetupBeforeHandlers method is the form being loaded - if you have registered multiple forms on the Forms tab on the plugin then the type of the form should be inspected to determine the code to execute.

Code Block
languagec#
public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
  if (JiwaForm is JiwaFinancials.Jiwa.JiwaPurchaseOrdersUI.MainForm)
  {
		// the Purchase Order form
  }
  else
  {
		// some other form
  }		
}

Setup

The Setup method, like the SetupBeforeHandlers method, is only invoked if the form is registered on the Forms tab of the plugin, but the Setup method is invoked after the form has added its event handlers for controls and 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.