Events can be published, subscribed, or created by an custom service, component model, or component.
Events can be published by calling the
.publish method on the event object.
In both components and services, event objects are accessed by injecting the relevant event reference class.
AllEvents class is a repository of all available events in the Geocortex Mobile SDK
Events can be subscribed to by calling the
.subscribe method on the event object.
In both components and services, event objects are accessed by injecting the event reference class.
It is vital that subscription handles are cleaned up when the object is cleaned up, otherwise dangling references can occur. This can be done by implementing the
IDisposableTracker interface, and then providing
this as the second argument to a call to subscribe.
ComponentBase already implement these interfaces so you don't have to.
Custom events in Geocortex Mobile are created through the
IEventRegistry. Events can be directly created in any component or service that can inject this class, but it is best practice to define events in a class that extends
EventsBase and registers with Autofac. This allows your events to be injected and referenced by any component or service across the app.
Events optionally take a type argument, which represents the object associated with the event consumed by the subscriber. This can be a simple or complex object.