Event Handling



Noah system implements a number of events that a business system needs to handle. It is up to the business system developer to decide which events the business system will react to.

The Noah Client is the event distributer in Noah system. Noah Client distributes the events to the Noah Server, the Business API or any Module APIs which are connected to Noah Client. Noah Client sends the events to all connected components besides the component, which has created the event. This implies that if a  Module creates an event by adding an action, then the event ActionAdded is sent to other connected parties besides the Module. Please refer to the figure below:  

                                         Figure: Event handling

In order for the business system to receive an event from Noah it must subscribe to the BusinessAPI event handle. The sample below shows how this is done in the sample business system. For a detailed description of the different available events please refer to the BusinessAPI Namespace BusinessAPI.NOAHEventType Enumeration in the BusinessAPI.chm file.

// businessApiObj is the BusinessAPI class initiatiated

businessApiObj.BusinessApiEvent += new  BusinessAPIEventDelegate(businessApiObj_BusinessApiEvent);

void businessApiObj_BusinessApiEvent(IBusinessApiEventArg arg)

        {

            string argEvent = arg.EventType.ToString();

            switch (arg)

               {

                case "ActionActivated":

                       break;

                case "ActionAdded":

                       break;

               case "ModuleFilterChanged":

                       break;

                default:

                    break;              

               }

       }





IMPORTANT: When handling events related to sessions and actions it is very important to test that the event is related to the current client as event related to a former current client may be received after the business system has changed client.

 

IMPORTANT: When using the Business API for Noah 4 the business system developer must be aware of a potential “Cross thread operation not valid exception” when trying to access a control by a thread other than the thread under which the control was created. This can be handled by either invoking any access to a control created by the event tread or implementing background work for the business system GUI when implementing in .NET. For further information, please refer to ‘Programming .NET components’, second edition, ISBEN-13: 978-0-596-10207-4 by Juval Lövel.