2011-05-27 78 views
0
我有與IEventAggregator一個小問題

,讓我解釋一下EventAggregator與多線程

public class doSomething 
{ 
    public doSomething() 
    { 
     Action<AddEvent> GetAddSolution = s => this.Add(s.a, s.b); 
     IEventAggregator.GetEvent<AddEvent>().Subscribe(GetAddSolution); 
    } 

    public void Add(int a, int b) 
    { 
     IEventAggregator.GetEvent<AddSolutionEvent>().Publish(new AddSolutionEventArgs(a + b)); 
    } 
} 

讓上面是演示服務,在我的情況下,它是一個長期運行的一個,現在如果我有多個線程調用使用EventAggrigator添加(a,b),發佈請求的最後一個線程獲取所有響應

如何向發佈請求事件的線程返回響應。

請提供指導。

先謝謝您。

回答

0

得到了答案我的自我,它的簡單,使用事件過濾器在eventaggregator。過濾器委託過濾事件。