Luxoria Modules - Event Documentation
This document describes the various events used in the Luxoria.Modules.Models.Events namespace, their purpose, and technical details.
List of Events
FilterCatalogEvent - Requests and retrieves a list of available filters.
CollectionUpdatedEvent - Notifies when a collection has been updated.
LogEvent - Sends a log message to the logging system.
RequestWindowHandleEvent - Requests the native window handle.
TextInputEvent - Sends a text input event.
1. FilterCatalogEvent
Purpose
The FilterCatalogEvent
is used to request and retrieve a list of available filters asynchronously.
Technical Details
Namespace:
Luxoria.Modules.Models.Events
Implements:
IEvent
Response Handling: Uses
TaskCompletionSource<List<(string Name, string Description, string Version)>>
to handle asynchronous responses.
Event Flow
A component publishes the event.
A subscriber (e.g., a filter manager) listens and provides the filter list.
The event’s
TaskCompletionSource
is completed with the filter list.The publisher receives the list.
Code Example
var filterEvent = new FilterCatalogEvent();
await _eventBus.Publish(filterEvent);
var receivedFilters = await filterEvent.Response.Task;
2. CollectionUpdatedEvent
Purpose
The CollectionUpdatedEvent
notifies subscribers when a collection has been updated.
Technical Details
Namespace:
Luxoria.Modules.Models.Events
Implements:
IEvent
Properties:
CollectionName
(string) - The name of the updated collection.CollectionPath
(string) - The file path of the collection.Assets
(ICollection) - The updated assets in the collection.
Event Flow
A module publishes this event after updating a collection.
Subscribers (e.g., UI components) react to the update.
Code Example
var updateEvent = new CollectionUpdatedEvent("MyCollection", "/path/to/collection", assets);
_eventBus.Publish(updateEvent);
3. LogEvent
Purpose
The LogEvent
is used to send log messages for debugging or monitoring purposes.
Technical Details
Namespace:
Luxoria.Modules.Models.Events
Implements:
IEvent
Properties:
Message
(string) - The log message.
Event Flow
Any component can publish this event to log information.
A logger service listens for this event and processes the message.
Code Example
_eventBus.Publish(new LogEvent("This is a log message."));
4. RequestWindowHandleEvent
Purpose
The RequestWindowHandleEvent
allows a component to request the native window handle.
Technical Details
Namespace:
Luxoria.Modules.Models.Events
Implements:
IEvent
Properties:
OnHandleReceived
(Action) - Callback to return the window handle.
Event Flow
A component publishes this event with a callback.
A subscriber (e.g., the main window) calls the callback with the window handle.
Code Example
var requestEvent = new RequestWindowHandleEvent(handle => Debug.WriteLine($"Handle: {handle}"));
_eventBus.Publish(requestEvent);
5. TextInputEvent
Purpose
The TextInputEvent
is used to transmit a text input from one component to another.
Technical Details
Namespace:
Luxoria.Modules.Models.Events
Implements:
IEvent
Properties:
Text
(string) - The text input.
Validation: Ensures the text is not
null
or empty.
Event Flow
A component publishes this event with a text message.
A subscriber processes the text input.
Code Example
_eventBus.Publish(new TextInputEvent("User input text"));
Conclusion
This document outlines the core events used in Luxoria's event-driven architecture. Each event plays a crucial role in communication between components, improving modularity and scalability.
Last updated