public List <NamedDataType> GetEventParameters()
 {
     if (EventHandlerType.IsLibType)
     {
         List <NamedDataType> pcs  = new List <NamedDataType>();
         ParameterInfo[]      pifs = null;
         MethodInfo           mif  = EventHandlerType.LibTypePointer.ClassType.GetMethod("Invoke");
         pifs = mif.GetParameters();
         if (pifs != null && pifs.Length > 0)
         {
             for (int i = 0; i < pifs.Length; i++)
             {
                 pcs.Add(new ParameterClass(pifs[i].ParameterType, pifs[i].Name, this, new MethodInfoPointer(mif)));
             }
         }
         return(pcs);
     }
     else
     {
         //use custom delegate type, it is a list of parameters
         if (EventHandlerType.ClassTypePointer == null)
         {
             throw new DesignerException("Custom event handler type cannot be null");
         }
         CustomEventHandlerType ceht = EventHandlerType.ClassTypePointer as CustomEventHandlerType;
         if (ceht == null)
         {
             throw new DesignerException("Invalid custom event handler type: {0}", EventHandlerType.ClassTypePointer.GetType().Name);
         }
         return(ceht.Parameters);
     }
 }
 public ParameterInfo[] GetParameters()
 {
     if (EventHandlerType.IsLibType)
     {
         MethodInfo mif = EventHandlerType.LibTypePointer.ClassType.GetMethod("Invoke");
         return(mif.GetParameters());
     }
     else
     {
         if (EventHandlerType.ClassTypePointer == null)
         {
             throw new DesignerException("GetParameters-Custom event handler type cannot be null");
         }
         CustomEventHandlerType ceht = EventHandlerType.ClassTypePointer as CustomEventHandlerType;
         if (ceht == null)
         {
             throw new DesignerException("GetParameters-Invalid custom event handler type: {0}", EventHandlerType.ClassTypePointer.GetType().Name);
         }
         List <ParameterInfo> lst = new List <ParameterInfo>();
         List <NamedDataType> ps  = ceht.Parameters;
         if (ps != null && ps.Count > 0)
         {
             foreach (NamedDataType p in ps)
             {
                 lst.Add(new ParameterInfoX(p));
             }
         }
         return(lst.ToArray());
     }
 }
        public List <ParameterClass> GetParameters(IMethod method)
        {
            List <ParameterClass> pcs = new List <ParameterClass>();

            if (EventHandlerType.IsLibType)
            {
                ParameterInfo[] pifs = null;
                MethodInfo      mif  = EventHandlerType.LibTypePointer.ClassType.GetMethod("Invoke");
                pifs = mif.GetParameters();
                if (pifs != null && pifs.Length > 0)
                {
                    for (int i = 0; i < pifs.Length; i++)
                    {
                        if (pifs[i].ParameterType.IsGenericParameter)
                        {
                            DataTypePointer dt = EventHandlerType.GetConcreteType(pifs[i].ParameterType);
                            if (dt != null)
                            {
                                pcs.Add(new ParameterClass(dt.BaseClassType, pifs[i].Name, this, new MethodInfoPointer(mif)));
                                continue;
                            }
                        }
                        pcs.Add(new ParameterClass(pifs[i].ParameterType, pifs[i].Name, this, new MethodInfoPointer(mif)));
                    }
                }
            }
            else
            {
                //use custom delegate type, it is a list of parameters
                if (EventHandlerType.ClassTypePointer == null)
                {
                    throw new DesignerException("Custom event handler type cannot be null");
                }
                CustomEventHandlerType ceht = EventHandlerType.ClassTypePointer as CustomEventHandlerType;
                if (ceht == null)
                {
                    throw new DesignerException("Invalid custom event handler type: {0}", EventHandlerType.ClassTypePointer.GetType().Name);
                }
                if (ceht.Parameters != null)
                {
                    foreach (NamedDataType ndt in ceht.Parameters)
                    {
                        pcs.Add(new ParameterClass(ndt.BaseClassType, ndt.Name, method));
                    }
                }
            }
            return(pcs);
        }
 private string getHandlerTypeDisplay()
 {
     if (_handlerType == null)
     {
         return("(?)");
     }
     if (_handlerType.IsLibType)
     {
         MethodInfo mif = _handlerType.LibTypePointer.ClassType.GetMethod("Invoke");
         return(MethodPointer.GetMethodSignature(mif, false));
     }
     else
     {
         CustomEventHandlerType ceht = _handlerType.ClassTypePointer as CustomEventHandlerType;
         if (_handlerType.ClassTypePointer == null)
         {
             return("(?)");
         }
         if (ceht == null)
         {
             throw new DesignerException("Invalid custom event handler type:{0}", _handlerType.ClassTypePointer.GetType().Name);
         }
         StringBuilder sb = new StringBuilder("(");
         if (ceht.ParameterCount > 0)
         {
             for (int i = 0; i < ceht.ParameterCount; i++)
             {
                 if (i > 0)
                 {
                     sb.Append(", ");
                 }
                 sb.Append(ceht.Parameters[i].DataTypeName);
                 sb.Append(" ");
                 sb.Append(ceht.Parameters[i].Name);
             }
         }
         sb.Append(")");
         return(sb.ToString());
     }
 }