private static EventInfo GetEventInfo(Type type, string name)
 {
     if ((s_cbmTdpBridge != null) && IsFrameworkType(type))
     {
         Type typeToUseForCBMBridge = GetTypeToUseForCBMBridge(type);
         if (s_cbmTdpBridge.HasEvent(typeToUseForCBMBridge, name))
         {
             return(type.GetEvent(name));
         }
         return(null);
     }
     if (GetReflectionType(type).GetEvent(name) != null)
     {
         return(type.GetEvent(name));
     }
     return(null);
 }
Ejemplo n.º 2
0
        private static EventInfo GetEventInfo(Type type, string name)
        {
            if (s_cbmTdpBridge != null && IsFrameworkType(type))
            {
                Type typeToUse = GetTypeToUseForCBMBridge(type);
                bool hasEvent  = s_cbmTdpBridge.HasEvent(typeToUse, name);
                if (hasEvent)
                {
                    return(type.GetEvent(name));
                }
                return(null);
            }

            Type      targetFrameworkType = GetReflectionType(type);
            EventInfo eventInfo           = targetFrameworkType.GetEvent(name);

            // Return the actual runtime EventInfo only if it was found in the target type.
            if (eventInfo != null)
            {
                return(type.GetEvent(name));
            }
            return(null);
        }