I am having an issue subscribing to events with the event Aggregator that comes as part of the prism framework.
If I use something such as
eventAggregato
MyEvent and MyEvent are not the same, so the EventAggregator doesn't see this as the same event. To allow for covariant types, you can fix it with the out modifier in C# 4. Something like this should work:
public interface IMyClass where T : IRequest { }
public class MyClass : IMyClass where T : IRequest { }
public class MyEvent : PubSubEvent> where TValue : IRequest { }
Then your event aggregator would look something like:
_eventAggregator.GetEvent>().Subscribe(Received);
private void Received(IMyClass obj)
{
}
_eventAggregator.GetEvent>().Publish(new MyClass());
Does this help?