在我的基础架构中,我发布了一个事件
In my infrastructure i publish a event
this.eventAggregator.GetEvent<ReportAddedEvent>().Publish(report);报表是一个对象
在我的控制器中我订阅了这个事件
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.
推荐答案我觉得是代码的问题
this.eventAggregator.GetEvent<ReportAddedEvent>().Subscribe(this.OnReportAdded);订阅 ReportAddedEvent 执行两次.
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.
更多推荐
Prism CompositePresentationEvent 触发两次
发布评论