Prism.PubSubEvents

namespace Microsoft.Practices.Prism.PubSubEvents
{
    public interface IEventAggregator
    {
        TEventType GetEvent<TEventType>() where TEventType : EventBase, new();
    }
}

namespace Microsoft.Practices.ServiceLocation
{
    public static class ServiceLocator
    {
        public static IServiceLocator Current { get; }
        public static bool IsLocationProviderSet { get; }

        public static void SetLocatorProvider(ServiceLocatorProvider newProvider);
    }
}


 private IEventAggregator _eventAggregator;
  _eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();

 _eventAggregator.GetEvent<ShowTipEvent>().Publish(new TipWindowViewModel
                {
                    Message = ResourceHelper.FindKey("TooManyPointsInPolyon"),
                    ShowConfirm = true
                });
原文地址:https://www.cnblogs.com/yuanchao/p/11379218.html