Events are named broadcasts which arrive at any model in the session (for example, for the same user) that is listening for them. There are two types of events: general events and widget events.
An event can be declared to have arguments, and the values are specified when the event is fired. For general events, it is important that all users of a given event declare it the same way.
For general events, put your Event Declaration builders in a single model and then import that model into any others that want to fire or handle the events. Events are named broadcasts across the session. Any other model that the same user is running at the time the event is fired can catch that event.
When you include an Event Declaration builder in a model, either directly or through an Imported Model builder, the builder creates, in your WebApp, a method called fireXxx
, where Xxx
is the event name. This method has the correct arguments, as defined in the Event Declaration builder.
To handle an event, create a method with the same arguments as the Event Declaration and then create an Event Handler builder to tell the system to route that named event to that method. If your model is instantiated, it listens for any model (including your own) that fires that event. Events are a good technique for communication when you know that a certain model (or type of model) exists, but you do not have a direct link to it.
For widget events, use the Widget Event builder input to specify whether the widget fires, handles, or both fires and handles the event. Specify how to handle the event in the same dialog box.
Parent topic: Overview: communicating between models: wpf7
Using widget events: wpf7