Sic04/FrameworkLocal/UIClient/Caliburn.Micro/Core/IEventAggregator.cs

36 lines
1.4 KiB
C#

namespace Caliburn.Micro.Core {
using System;
/// <summary>
/// Enables loosely-coupled publication of and subscription to events.
/// </summary>
public interface IEventAggregator {
/// <summary>
/// Searches the subscribed handlers to check if we have a handler for
/// the message type supplied.
/// </summary>
/// <param name="messageType">The message type to check with</param>
/// <returns>True if any handler is found, false if not.</returns>
bool HandlerExistsFor(Type messageType);
/// <summary>
/// Subscribes an instance to all events declared through implementations of <see cref = "IHandle{T}" />
/// </summary>
/// <param name = "subscriber">The instance to subscribe for event publication.</param>
void Subscribe(object subscriber);
/// <summary>
/// Unsubscribes the instance from all events.
/// </summary>
/// <param name = "subscriber">The instance to unsubscribe.</param>
void Unsubscribe(object subscriber);
/// <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);
}
}