예제 #1
0
 public GenericEventClosure(long entity_id, int event_id, long handler_id, InvokeEventCallabck invokeevent)
 {
     _EntityId   = entity_id;
     _EventId    = event_id;
     _HandlerId  = handler_id;
     InvokeEvent = invokeevent;
 }
예제 #2
0
        private Delegate _BuildDelegate(EventInfo info, Guid entity_id, InvokeEventCallabck invoke_Event)
        {
            var eventCreator = _EventProvider.Find(info);
            var map          = _Protocol.GetMemberMap();
            var id           = map.GetEvent(info);

            return(eventCreator.Create(entity_id, id, invoke_Event));
        }
예제 #3
0
        public void SoulEventInvokeTest()
        {
            TestType obj  = NSubstitute.Substitute.For <TestType>();
            var      soul = new SoulProxy(0, 0, typeof(TestType), obj);

            string eventCatcher          = "";
            InvokeEventCallabck callback = (entiry_id, event_id, handler_id, args) =>
            {
                eventCatcher = $"{entiry_id}-{event_id}-{handler_id}";
            };
            GenericEventClosure closure = new GenericEventClosure(1, 1, 1, callback);

            System.Reflection.EventInfo info = typeof(TestType).GetEvent("TestEvent");
            soul.AddEvent(new SoulProxyEventHandler(obj, new System.Action(closure.Run), info, 1));

            obj.TestEvent += Raise.Event <Action>();

            Assert.Equal("1-1-1", eventCatcher);

            soul.RemoveEvent(info, 1);
        }
예제 #4
0
        private Delegate _BuildDelegate(EventInfo info, long entity_id, long handler_id, InvokeEventCallabck invoke_Event)
        {
            IEventProxyCreator eventCreator = _EventProvider.Find(info);
            MemberMap          map          = _Protocol.GetMemberMap();
            int id = map.GetEvent(info);

            return(eventCreator.Create(entity_id, id, handler_id, invoke_Event));
        }
예제 #5
0
 public GenericEventClosure(Guid entity_id, int event_id, InvokeEventCallabck invokeevent)
 {
     EntityId    = entity_id;
     EventId     = event_id;
     InvokeEvent = invokeevent;
 }