Ejemplo n.º 1
0
 public static IHandles GetSystem()
 {
     if (HandlesSystem.m_System == null)
     {
         HandlesSystem.m_System = new HandlesSystem();
     }
     return(HandlesSystem.m_System);
 }
Ejemplo n.º 2
0
 static public IHandles GetSystem()
 {
     if (m_System == null)
     {
         m_System = new HandlesSystem();
     }
     return(m_System);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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);
                }
            }
        }
Ejemplo n.º 8
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public static void SetSystem(IHandles system)
 {
     HandlesSystem.m_System = system;
 }
Ejemplo n.º 10
0
 public void RegisterEventHandler <TEvent>(IHandles <TEvent> handler) where TEvent : IEvent
 {
 }
Ejemplo n.º 11
0
 static public void SetSystem(IHandles system)
 {
     m_System = system;
 }