To fix the problem with the line of code you mentioned you might use the following one:
presenter = unityContainer.Resolve(tp) as
Though I don't know you whole scenario, but there might be some drawbacks in the approach you are using:
The use of reflection might have performance issues. More over if the method is going to execute each time an event is published.
You will need to register all the types in the container. If not an exception is going to be thrown when trying to resolve an unregistered type.
Even if you register all the types you need, you are creating a new instance of the presenter (and calling the
ExecuteCommand method on the new instance, not in the one that actually published the event). (This might not be an issue if you intend it to be that way)
If I understood your scenario correctly, you need the presenter to send some information (using an event?) that will trigger some operation.
When the operation is finished, you need to execute the ExecuteCommand method on the presenter.
To achieve this you might, instead of handling the event published when the operation is finished in the controller, have it handled
in the presenters using a filters (to filter by the presenter's ID). For example:
false, command => command.CallerID == this.ID);
This way you will avoid all of the above drawbacks, reduce the controller's logic, and keep everything decoupled (though having the ID
going around might not be that decoupled).
Hope it helps!