Files
aistudio-wpf-diagram/AIStudio.Wpf.DiagramDesigner/Messenger/MediatorMessageSinkAttribute.cs
2022-10-28 22:45:39 +08:00

40 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AIStudio.Wpf.DiagramDesigner
{
/// <summary>
/// This attribute allows a method to be targeted as a recipient for a message.
/// It requires that the Type is registered with the MessageMediator through the
/// <seealso cref="MessageMediator.Register"/> method
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class MediatorMessageSinkAttribute : Attribute
{
/// <summary>
/// Message key
/// </summary>
public object MessageKey { get; private set; }
/// <summary>
/// Default constructor
/// </summary>
public MediatorMessageSinkAttribute()
{
MessageKey = null;
}
/// <summary>
/// Constructor that takes a message key
/// </summary>
/// <param name="messageKey">Message Key</param>
public MediatorMessageSinkAttribute(string messageKey)
{
MessageKey = messageKey;
}
}
}