diff --git a/src/Prism.Events/IEventAggregator.cs b/src/Prism.Events/IEventAggregator.cs index 47bc0b2a4..535aac117 100644 --- a/src/Prism.Events/IEventAggregator.cs +++ b/src/Prism.Events/IEventAggregator.cs @@ -7,13 +7,26 @@ namespace Prism.Events /// /// Defines an interface to get instances of an event type. /// + /// + /// + /// is the main entry point for the Pub/Sub event system in Prism. + /// It maintains a singleton collection of event instances and provides a way to retrieve or create events by type. + /// + /// + /// Typically, you inject into your ViewModels and use it to publish and subscribe to loosely-coupled events. + /// + /// public interface IEventAggregator { /// /// Gets an instance of an event type. /// - /// The type of event to get. - /// An instance of an event object of type . + /// The type of event to get. Must be a type that inherits from and has a parameterless constructor. + /// An instance of an event object of type . Multiple calls with the same type return the same instance (singleton). + /// + /// This method returns a singleton instance of the requested event type. If the event does not yet exist, it will be created. + /// Subsequent calls with the same type parameter will return the same instance. + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] TEventType GetEvent() where TEventType : EventBase, new(); } diff --git a/src/Prism.Events/ThreadOption.cs b/src/Prism.Events/ThreadOption.cs index 0cf211903..e2c689d4a 100644 --- a/src/Prism.Events/ThreadOption.cs +++ b/src/Prism.Events/ThreadOption.cs @@ -7,21 +7,37 @@ namespace Prism.Events /// /// Specifies on which thread a subscriber will be called. /// + /// + /// + /// This enumeration is used when subscribing to Pub/Sub events to control where the subscription callback is executed. + /// The choice affects threading behavior and should be considered based on the nature of the work being performed. + /// + /// public enum ThreadOption { /// /// The call is done on the same thread on which the was published. /// + /// + /// This is the default and most performant option. Use this when the callback doesn't need to interact with the UI. + /// PublisherThread, /// /// The call is done on the UI thread. /// + /// + /// Use this option when the callback needs to update UI elements. On XAML platforms, this typically means the thread + /// that created the UI dispatcher. On non-UI platforms, this behaves like PublisherThread. + /// UIThread, /// /// The call is done asynchronously on a background thread. /// + /// + /// Use this option when the callback performs long-running operations that shouldn't block the publisher thread. + /// BackgroundThread } }