<Feature Request> Messenger NotificationMessageAction support for Objects as notification

Jun 15, 2011 at 10:30 AM

Loving the framework and learning so much more every day using the framework.

One thing I found missing while using the messenger with callback though was the ability to pass an object with the message to feed into the receiving object and then feed back another object with the callback.

At the moment I can only send a string as the notification (the .Notification property) and I think this would be better to be more generic like the rest of the messenger methods.

Something along the lines of:

Messenger.Default.Send<ObservableCollection<AddonModel>>(new NotificationMessageAction<ObservableCollection<AddonModel>>(object,(message) => { localColection = null; localColection = message;});

So that it is in line with the other Send methods.

Jun 22, 2011 at 10:14 AM

I had the same needs and I ended up writing a new class (a message) that combines GenericMessage<T> and NotificationMessageAction<T> classes of the Toolkit.

public class GenericMessageAction<TMessageData, TCallbackParameter> : NotificationMessageAction<TCallbackParameter>
        public GenericMessageAction(TMessageData data, Action<TCallbackParameter> callback)
            : base("", callback)
            this.Data = data;

        public GenericMessageAction(Action<TCallbackParameter> callback)
            : base("", callback)

        public TMessageData Data { get; set; }

I found this to be extremely useful for me and I'm wondering why it is not part of the toolkit (or maybe I'm doing something wrong...).

Sep 15 at 2:32 PM
Could you provide an example on how I can use it?