【问题标题】:WPF Prism (CAL) - Find all Subscriptions to the EventAggregator on any eventWPF Prism (CAL) - 在任何事件上查找 EventAggregator 的所有订阅
【发布时间】:2011-09-14 17:45:37
【问题描述】:

有没有办法查看 EventAggregator 中包含的所有事件的所有订阅?

EventAggregator 中只有一个 .GetEvent 方法……但我只想查看其中包含的所有订阅……而不必依次执行每个 Event。

谢谢

【问题讨论】:

    标签: wpf prism-2 cal


    【解决方案1】:

    out-of-the-box implementation 不提供获取所有事件的方法。因此,如果你想要这个,你需要:

    • 采用令人讨厌的反思将事件字典从您的EventAggregator 中提取出来
    • IEventAggregator 补充另一个产生所有事件的属性。您不能使用继承来添加它,因为事件字典被声明为私有的,而不是受保护的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-29
      • 2011-08-14
      相关资源
      最近更新 更多