/// <summary> /// Convenient helper method to unsubscribe from this Message type. /// <para/> /// Usage: /// <list type="bullet"> /// <item><description>MessageClass.Register(this, msg => Handler) if the handler has the signature void Handler(MessageClass message)</description></item> /// <item><description>MessageClass.Register(this, msg => Handler(msg.Data)) if the handler has the signature void Handler(TData data)</description></item> /// </list> /// </summary> /// <param name="recipient">The instance which unregisters from the messages. Is most cases this will be <c>this</c>.</param> /// <param name="handler">A delegate handling the incoming message. For example: msg => Handler(msg.Data).</param> /// <param name="tag">The optional Catel mediator tag to be used.</param> /// <exception cref="ArgumentNullException">The <paramref name="handler"/> is <c>null</c>.</exception> public static void Unregister(object recipient, Action <TMessage> handler, object tag = null) { Argument.IsNotNull("handler", handler); _mediator.Unregister(recipient, handler, tag); }
protected override Task CloseAsync() { _messageMediator.Unregister <ActivatedExplorerTabMessage>(this, OnActivatedExplorerTabMessageReceived); return(base.CloseAsync()); }
private void MainWindow_OnUnloaded(object sender, RoutedEventArgs e) { _messageMediator.Unregister(this); }