When Lucy is starting up or shutting down, several events are fired to notify registered listeners of the progress. These events can be used, for instance, to display a splash screen when Lucy is starting, or to ask the user to save data when Lucy is about to close. To receive notifications of these events, you must register an ILcyLucyEnvListener with the Lucy back-end using the methods addLucyEnvListener. You can remove it using the method removeLucyEnvListener. You can get the active state of Lucy with the method getLucyEnvState.

The listeners are notified of the Lucy events with the method lucyEnvStatusChanged, which takes a TLcyLucyEnvEvent as parameter. This object has an ID, which is one of the following:

TLcyLucyEnvEvent.INITIALIZING

Indicates that Lucy is starting the initialization process. You can use this event to pop up a splash screen, for instance.

TLcyLucyEnvEvent.INITIALIZED

Indicates that Lucy has finished its initialization process and is ready for use. You could use this to hide the splash screen, for instance.

TLcyLucyEnvEvent.CLOSING

Indicates that Lucy is starting the closing process. You can use this event to ask the users if they want to save some unsaved changes, for instance.

TLcyLucyEnvEvent.CLOSED

Indicates that Lucy had finished the closing process.

TLcyLucyEnvEvent.DISPOSING

Indicates that Lucy is starting the disposal process.

TLcyLucyEnvEvent.DISPOSED

Indicates that Lucy has finished the disposal process.

An important aspect of the lucyEnvStatusChanged method is that it can throw a TLcyVetoException. If a listener decides that it cannot allow Lucy to change its state to the state specified by the ID of the event, that listener can throw a TLcyVetoException to prevent this change from completing. The most obvious use for this is to prevent the closing of Lucy when something has not been saved yet. If a listener throws a TLcyVetoException, all listeners that were already notified of the changed state, are notified of the reverse state change. For instance, when a certain listener throws a TLcyVetoException on an event with ID TLcyLucyEnvEvent.CLOSING, all listeners that were already notified before that listener will receive an event with ID TLcyLucyEnvEvent.INITIALIZED, which was the previous state.

The events are always fired in the order in which they are listed here. The only exception is when a listener throws a TLcyVetoException, at which point all listeners that had already been notified of the state change are notified of the reverse state change as noted above.