Event Aggregator

Event Aggregator -- 彻底解耦了事件的定义与行为。

一般的事件使用中,我们至少需要引用到定义事件的类。比如,

class A

{

//define event

}

class B

{

//some behaviour

}

class ControlClass

{

  A a = new A();

  a.EventX += B.Method1;

}

使用了EventAggregator后,我们在事件定义的时候Publish,仅需要在其它任何需要的地方Subscribe!

原文地址:https://www.cnblogs.com/silva/p/2446066.html