klashagelqvist
klashagelqvist

Reputation: 1261

Prism CompositePresentationEvent fires twice

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.

Upvotes: 2

Views: 2072

Answers (1)

Jehof
Jehof

Reputation: 35544

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.

Upvotes: 6

Related Questions