public override ParameterClassSubMethod GetParameterType(UInt32 id, SubMethodInfoPointer owner, AB_SubMethodAction action)
        {
            ParameterClassSubMethod p;

            ParameterInfo[] ps = GetParameters();

            p             = new ParameterClassCollectionItem(ps[0].ParameterType, ps[0].Name, action);
            p.ParameterID = (UInt32)(ps[0].GetHashCode());
            p.Method      = owner;
            p.ActionId    = owner.ActionOwner.ActionId;
            return(p);
        }
 public void OnPostRootDeserialize()
 {
     if (_iconList != null)
     {
         foreach (ComponentIcon ci in _iconList)
         {
             ComponentIconActionBranchParameter ciap = ci as ComponentIconActionBranchParameter;
             if (ciap != null)
             {
                 ParameterClassCollectionItem pcci = ciap.ClassPointer as ParameterClassCollectionItem;
                 if (pcci != null && pcci.BaseClassType != null)
                 {
                     if (pcci.BaseClassType.IsGenericParameter)
                     {
                         if (pcci.ConcreteType == null)
                         {
                             if (ActionData != null)
                             {
                                 MethodPointer mp = this.ActionData.ActionMethod as MethodPointer;
                                 if (mp != null)
                                 {
                                     DataTypePointer dp = mp.GetConcreteType(pcci.BaseClassType);
                                     if (dp != null)
                                     {
                                         pcci.SetConcreteType(dp);
                                     }
                                 }
                             }
                         }
                     }
                     else if (pcci.BaseClassType.IsGenericType && pcci.BaseClassType.ContainsGenericParameters)
                     {
                         if (pcci.TypeParameters == null)
                         {
                             if (ActionData != null)
                             {
                                 MethodPointer mp = this.ActionData.ActionMethod as MethodPointer;
                                 if (mp != null)
                                 {
                                     DataTypePointer dp = mp.GetConcreteType(pcci.BaseClassType);
                                     if (dp != null)
                                     {
                                         pcci.TypeParameters = dp.TypeParameters;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #3
0
        protected override void OnCreateContextMenu(ContextMenu mnu, Point location)
        {
            base.OnCreateContextMenu(mnu, location);
            Type t = null;
            ParameterClassArrayItem      ap = this.ClassPointer as ParameterClassArrayItem;
            ParameterClassCollectionItem ci = this.ClassPointer as ParameterClassCollectionItem;

            if (ap != null)
            {
                t = ap.BaseClassType;
            }
            else if (ci != null)
            {
                t = ci.BaseClassType;
            }
            if (t != null)
            {
                if (this.Parent != null)
                {
                    List <ComponentIconLocal> list = new List <ComponentIconLocal>();
                    foreach (Control c in this.Parent.Controls)
                    {
                        ComponentIconLocal cil = c as ComponentIconLocal;
                        if (cil != null)
                        {
                            if (t.IsAssignableFrom(cil.LocalPointer.BaseClassType))
                            {
                                list.Add(cil);
                            }
                        }
                    }
                    if (list.Count > 0)
                    {
                        if (mnu.MenuItems.Count > 0)
                        {
                            mnu.MenuItems.Add("-");
                        }
                        MenuItemWithBitmap mi = new MenuItemWithBitmap("Use it as", Resources._as.ToBitmap());
                        mnu.MenuItems.Add(mi);
                        foreach (ComponentIconLocal cil in list)
                        {
                            MenuItemWithBitmap mi0 = new MenuItemWithBitmap(cil.Label.Text, mi_useAs, VPL.VPLUtil.GetTypeIcon(cil.ClassPointer.ObjectType));
                            mi0.Tag = cil;
                            mi.MenuItems.Add(mi0);
                        }
                    }
                }
            }
        }