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
                });

 

上一篇:c# – 我的部分GUI很慢


下一篇:从PRISM开始学WPF(三)Prism-Region-更新至Prism7.1