public static IHandles GetSystem() { if (HandlesSystem.m_System == null) { HandlesSystem.m_System = new HandlesSystem(); } return(HandlesSystem.m_System); }
static public IHandles GetSystem() { if (m_System == null) { m_System = new HandlesSystem(); } return(m_System); }
public static void Register <T>(IHandles <IDomainEvent> handler) where T : IDomainEvent { if (Container == null) { Container = new List <IHandles <IDomainEvent> >(); } Container.Add(handler); }
public void HandleTMessage_releys_with_non_cancellation_token(Envelope <object> envelope) { var task = Task.FromResult(true); IHandles <object> handles = Mock.Of <IHandles <object> >( x => x.Handle(envelope, CancellationToken.None) == task); Task result = handles.Handle(envelope); Mock.Get(handles).Verify(x => x.Handle(envelope, CancellationToken.None), Times.Once()); result.Should().BeSameAs(task); }
public ShapeEditor(IGUIUtility gu, IEventSystem es) { m_Selection = new ShapeEditorSelection(this); guiUtility = gu; eventSystem = es; k_CreatorID = guiUtility.GetPermanentControlID(); k_EdgeID = guiUtility.GetPermanentControlID(); k_RightTangentID = guiUtility.GetPermanentControlID(); k_LeftTangentID = guiUtility.GetPermanentControlID(); glSystem = GLSystem.GetSystem(); handles = HandlesSystem.GetSystem(); }
public static Task Handle <TMessage>( this IHandles <TMessage> handles, Envelope <TMessage> envelope) where TMessage : class { if (handles == null) { throw new ArgumentNullException(nameof(handles)); } return(handles.Handle(envelope, CancellationToken.None)); }
public static void Raise <T>(T domainEvent) where T : IDomainEvent { foreach (Delegate handler in _dynamicHandlers[domainEvent.GetType()]) { var action = (Action <T>)handler; action(domainEvent); } foreach (Type handler in _staticHandlers) { if (typeof(IHandles <T>).IsAssignableFrom(handler)) { IHandles <T> instance = (IHandles <T>)Activator.CreateInstance(handler); instance.Handle(domainEvent); } } }
public async static Task RaiseAsync <T>(T args) where T : IDomainEvent { if (_container != null) { IHandles <T> service = ((IHandles <T>)_container.GetService(typeof(IHandles <T>))); if (service != null) { await service.HandleAsync(args); } } if (_actions != null) { foreach (var action in _actions) { if (action is Action <T> ) { ((Action <T>)action)(args); } } } }
public static void SetSystem(IHandles system) { HandlesSystem.m_System = system; }
public void RegisterEventHandler <TEvent>(IHandles <TEvent> handler) where TEvent : IEvent { }
static public void SetSystem(IHandles system) { m_System = system; }