/* ----------------------------------------------------------------- */ /// /// Post /// /// <summary> /// Posts the specified message. /// </summary> /// /// <param name="message">Message to be posted.</param> /// /* ----------------------------------------------------------------- */ protected void Post <T>(T message) => _post.Invoke(() => Aggregator.Publish(message));
/* ----------------------------------------------------------------- */ /// /// Subscribe /// /// <summary> /// Subscribes the message of type T. /// </summary> /// /// <typeparam name="T">message type.</typeparam> /// /// <param name="callback"> /// Action to be invoked when the message of type T is published. /// </param> /// /// <returns>Object to clear the subscription.</returns> /// /* ----------------------------------------------------------------- */ public IDisposable Subscribe <T>(Action <T> callback) => Aggregator.Subscribe(callback);
/* ----------------------------------------------------------------- */ /// /// Send /// /// <summary> /// Sends the specified message. /// </summary> /// /// <param name="message">Message to be sent.</param> /// /* ----------------------------------------------------------------- */ protected void Send <T>(T message) => _send.Invoke(() => Aggregator.Publish(message));
/* ----------------------------------------------------------------- */ /// /// PresentableBase /// /// <summary> /// Initializes a new instance of the PresentableBase class with /// the specified arguments. /// </summary> /// /// <param name="aggregator">Message aggregator.</param> /// /* ----------------------------------------------------------------- */ protected PresentableBase(Aggregator aggregator) : this(aggregator, SynchronizationContext.Current) { }