prism 中EventAggregator事件过滤(Subscription Filtering)

xiaoxiao2025-04-29  10

Subscription Filtering

Subscribers may not need to handle every instance of a published event. In these cases, the subscriber can subscribe and supply a delegate that filters the event before the registered handler is called. Frequently, this filter is supplied as a lambda expression, as shown in the following code.

C#Copy

FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == _customerId);
转载请注明原文地址: https://www.6miu.com/read-5029440.html

最新回复(0)