mirror of https://github.com/Sonarr/Sonarr
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
|
using System;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace NzbDrone.Common.Eventing
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Enables loosely-coupled publication of and subscription to events.
|
|||
|
/// </summary>
|
|||
|
public interface IEventAggregator
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Gets or sets the default publication thread marshaller.
|
|||
|
/// </summary>
|
|||
|
/// <value>
|
|||
|
/// The default publication thread marshaller.
|
|||
|
/// </value>
|
|||
|
Action<Action> PublicationThreadMarshaller { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Subscribes an instance to all events declared through implementations of <see cref = "IHandle{T}" />
|
|||
|
/// </summary>
|
|||
|
/// <param name = "instance">The instance to subscribe for event publication.</param>
|
|||
|
void Subscribe(object instance);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Unsubscribes the instance from all events.
|
|||
|
/// </summary>
|
|||
|
/// <param name = "instance">The instance to unsubscribe.</param>
|
|||
|
void Unsubscribe(object instance);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Publishes a message.
|
|||
|
/// </summary>
|
|||
|
/// <param name = "message">The message instance.</param>
|
|||
|
/// <remarks>
|
|||
|
/// Uses the default thread marshaller during publication.
|
|||
|
/// </remarks>
|
|||
|
void Publish(object message);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Publishes a message.
|
|||
|
/// </summary>
|
|||
|
/// <param name = "message">The message instance.</param>
|
|||
|
/// <param name = "marshal">Allows the publisher to provide a custom thread marshaller for the message publication.</param>
|
|||
|
void Publish(object message, Action<System.Action> marshal);
|
|||
|
}
|
|||
|
}
|