From 71189ecba057b5209f4035d12691c3daa4ccecdf Mon Sep 17 00:00:00 2001 From: Sachin Kumar Date: Wed, 4 Feb 2026 08:14:53 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20#1978=20=E2=80=94=20Add=20XML=20docs=20fo?= =?UTF-8?q?r=20EventAggregator=20APIs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Prism.Events/IEventAggregator.cs | 17 +++++++++++++++-- src/Prism.Events/ThreadOption.cs | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Prism.Events/IEventAggregator.cs b/src/Prism.Events/IEventAggregator.cs index 47bc0b2a42..535aac117b 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 0cf2119032..e2c689d4ad 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 } }