Not sure if this was a design decision but IMessenger.Send seems to be missing overload that accepts a token
+2
A:
Assuming that by "token" you mean a string that identifies something about the message, there are several things you can do.
You can use the NotificationMessage class as the message you're sending.
Messenger.Default.Send(new NotificationMessage("Token"));
If you want to use something other than a string as a token, you can use NotificationMessage.
Messenger.Default.Send(new NotificationMessage<IToken>(new Token()));
You can create your own message class and use it. This lets you register for only messages of your custom type. This is what I recommend.
public class ErrorMessage : GenericMessage<Exception> { public ErrorMessage(Exception content) : base(content) { } public ErrorMessage(object sender, Exception content) : base(sender, content) { } public ErrorMessage(object sender, object target, Exception content) : base(sender, target, content) { } }
Matt Casto
2010-06-28 16:37:18
I agree with this too.
Rick Ratayczak
2010-07-11 22:04:42