19 using System.Collections.Generic;
33 #region IViewModelMessage interface 39 public event EventHandler<MessageArgs<T>>
Sent;
43 #region Protected methods 56 EventHandler<MessageArgs<T>> h = Sent;
59 Logger.Info(
"Sending message to {0} subscriber(s)", h.GetInvocationList().Length);
60 Logger.Debug(
"Message content is a {0}",
61 messageContent == null ?
"null reference" : messageContent.GetType().FullName);
67 if (respond != null) respond(messageContent);
80 public virtual void Send(T messageContent)
82 Send(messageContent, null);
97 private static NLog.Logger Logger {
get {
return _logger.Value; } }
99 private static readonly Lazy<
NLog.Logger> _logger =
new Lazy<
NLog.Logger>(() =>
NLog.LogManager.GetCurrentClassLogger());
virtual void Send(T messageContent)
Raises the Sent event with a MessageArgs instance that encapsulates the messageContent ...
virtual void Send(T messageContent, Action< T > respond)
Calling this method will raise the Sent event with a message content and a callback method that can b...
EventHandler< MessageArgs< T > > Sent
Consumers of the view model subscribe to this event if they want to listen for the message...
Conveys a message from a view model to a consumer (typically, a view) that has subscribed to the Sent...
Simple object that encapsulates a boolean value; to be used in MVVM interaction with MessageArgs...
virtual void Send()
Sends a simple message that does not need responding to.
Defines a Sent event that consumers of a view model can subscribe to in order to listen to the view m...