Exemplo n.º 1
0
        private void onRemoveEventHandler(RAIS_R r, object data)
        {
            OM_EventData e  = (OM_EventData)data;
            EventInfo    ei = r.Instance.GetType().GetEvent(e.EventName);

            ei.RemoveEventHandler(r.Instance, e.Handler);
        }
        private void onRemoveEventHandler(object instance, object data)
        {
            OM_EventData e  = (OM_EventData)data;
            EventInfo    ei = _type.GetEvent(e.EventName);

            ei.RemoveEventHandler(instance, e.Handler);
        }
Exemplo n.º 3
0
        public void RemoveEventHandler(string eventName, object methodOwner, string methodName)
        {
            EventInfo             ei = _type.GetEvent(eventName);
            object                v  = DotNetUtilEvent.CreateDelegate(ei.EventHandlerType, methodOwner, methodName);
            OM_EventData          e  = new OM_EventData(eventName, (Delegate)v);
            delegateOnGetInstance eh = new delegateOnGetInstance(onRemoveEventHandler);

            WorkOnAllInstances(eh, e);
        }
 public void RemoveEventHandler(string eventName, object methodOwner, string methodName)
 {
     if (methodOwner == null)
     {
         methodOwner = Container;
     }
     if (methodOwner != null)
     {
         EventInfo             ei = _type.GetEvent(eventName);
         object                v  = Activator.CreateInstance(ei.EventHandlerType, new object[] { methodOwner, methodName });
         OM_EventData          e  = new OM_EventData(eventName, (Delegate)v);
         delegateOnGetInstance eh = new delegateOnGetInstance(onRemoveEventHandler);
         WorkOnAllInstances(eh, e);
     }
 }
 public virtual void AddEventHandler(Type t, string eventName, object methodOwner, string methodName)
 {
     if (methodOwner == null)
     {
         methodOwner = Container;
     }
     if (methodOwner != null)
     {
         EventInfo             ei = _type.GetEvent(eventName);
         object                v  = Activator.CreateInstance(ei.EventHandlerType, new object[] { methodOwner, methodName });
         OM_EventData          e  = new OM_EventData(eventName, (Delegate)v);
         delegateOnGetInstance eh = new delegateOnGetInstance(onAddEventHandler);
         WorkOnAllInstances(t, eh, e);
         if (_assignedToTypes == null)
         {
             _assignedToTypes = new Dictionary <Type, OM_EventData>();
         }
         _assignedToTypes.Add(t, e);
     }
     //bool bFound = false;
     //int n = this.SubTypeCount;
     //if (n > 0)
     //{
     //    IObjectManager[] subType = SubTypes;
     //    for (int i = 0; i < n; i++)
     //    {
     //        if (t.Equals(subType[i].InstanceType))
     //        {
     //            subType[i].AddEventHandler(eventName, methodOwner, methodName);
     //            bFound = true;
     //            break;
     //        }
     //        else
     //        {
     //            bFound = subType[i].AddEventHandler(t, eventName, methodOwner, methodName);
     //            if (bFound)
     //                break;
     //        }
     //    }
     //}
     //return bFound;
 }