Prism CompositePresentationEvent fires twice

拥有回忆 提交于 2019-12-24 16:06:14

问题


In my infrastructure i publish a event

  this.eventAggregator.GetEvent<ReportAddedEvent>().Publish(report);

the report is a object

In my controller i subscribe to this event

  this.eventAggregator.GetEvent<ReportAddedEvent>().Subscribe(this.OnReportAdded);

My problem is that the event fires twice. There is no other place in the entire code where the event is published so im certain that the event is not fired somewhere else and i can see it only fires once.

Anyone have a suggestion or have a solution to problem or knows where the problem lies.


回答1:


I think the problem is that the code

this.eventAggregator.GetEvent<ReportAddedEvent>().Subscribe(this.OnReportAdded);

to subscribe to the ReportAddedEvent is executed two times.

You should check (by using a debugger and a breakpoint on the line) if it executes more than once.



来源:https://stackoverflow.com/questions/9276494/prism-compositepresentationevent-fires-twice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!