其他分享
首页 > 其他分享> > Prism.PubSubEvents

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

 

标签:eventAggregator,Current,Prism,static,PubSubEvents,GetEvent,public
来源: https://www.cnblogs.com/yuanchao/p/11379218.html