예제 #1
0
        //--------------------------------------
        // PRIVATE DISPATCH I2
        //--------------------------------------


        private void dispatch(int eventID, object data, string eventName)
        {
            CEvent e = new CEvent(eventID, eventName, data, this);


            if (dataListners.ContainsKey(eventID))
            {
                List <DataEventHandlerFunction> handlers = cloenArray(dataListners[eventID]);
                int len = handlers.Count;
                for (int i = 0; i < len; i++)
                {
                    if (e.canBeDisptached(handlers[i].Target))
                    {
                        handlers[i](e);
                    }
                }
            }


            if (listners.ContainsKey(eventID))
            {
                List <EventHandlerFunction> handlers = cloenArray(listners[eventID]);
                int len = handlers.Count;
                for (int i = 0; i < len; i++)
                {
                    if (e.canBeDisptached(handlers[i].Target))
                    {
                        handlers[i]();
                    }
                }
            }
        }
    //--------------------------------------
    // PRIVATE DISPATCH I2
    //--------------------------------------
    private void dispatch(int eventID, object data, string eventName)
    {
        CEvent e = new CEvent(eventID, eventName, data, this);

        if(dataListners.ContainsKey(eventID)) {
            List<DataEventHandlerFunction>  handlers = cloenArray(dataListners[eventID]);
            int len = handlers.Count;
            for(int i = 0; i < len; i++) {
                if(e.canBeDisptached(handlers[i].Target)) {
                    handlers[i](e);

                }
            }
        }

        if(listners.ContainsKey(eventID)) {
            List<EventHandlerFunction>  handlers = cloenArray(listners[eventID]);
            int len = handlers.Count;
            for(int i = 0; i < len; i++) {
                if(e.canBeDisptached(handlers[i].Target)) {
                    handlers[i]();
                }

            }
        }
    }