Currently im trying to implement an EventAggregator using prism to publish and subscribe events in between two modules.
I try to implement it in the way described here MSDN. But i stuck already at the begin.
I implemented an event in my Infrastructure namespace:
namespace Infrastructure
{
public class MyAggregatorEvent : PubSubEvent<string>{}
}
In my first module i would like to publish/raise this event in the following way"
private PublishEvent()
{
IEventAggregator _eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
_eventAggregator.GetEvent<MyAggregatorEvent>().Publish("Test");
}
But the problem is that i cant call the Publish() method. I always get an error saying:
Infrastructure.MyAggregatorEvent' does not contain a definition for 'Publish' and no extension method 'Publish' accepting a first argument of type 'Infrastructure.MyAggregatorEvent' could be found (are you missing a using directive or an assembly reference?) D:\PviVm.cs ModulePvi
I read a lot of articles in the web but couldn't figure out what im doing wrong.
Has anybody an idea what im doing wrong?