예제 #1
0
 public List <ParameterClassSubMethod> GetParameters(AB_SubMethodAction actionBranch)
 {
     if (_methodPointer == null)
     {
         return(new List <ParameterClassSubMethod>());
     }
     return(_methodPointer.GetParameters(actionBranch));
 }
        public override object Clone()
        {
            AB_SubMethodAction obj = (AB_SubMethodAction)base.Clone();

            obj._actId      = _actId;
            obj._actionData = _actionData;
            obj._imgLayout  = _imgLayout;
            if (_iconList != null)
            {
                obj._iconList = new List <ComponentIcon>();
                foreach (ComponentIcon c in _iconList)
                {
                    obj._iconList.Add((ComponentIcon)c.Clone());
                }
            }
            return(obj);
        }
        public void OnDeserialize(object context)
        {
            string err;

            _root = context as ClassPointer;
            if (_root == null)
            {
                if (context == null)
                {
                    err = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.OnDeserialize(object context): context is null. MethodId:{1},BranchId:{2},ParameterId:{3},ParameterName:{4}", this.GetType().Name, MethodId, BranchId, ParameterId, ParameterName);
                }
                else
                {
                    err = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.OnDeserialize(object context): context {1} is not a ClassPointer. MethodId:{2},BranchId:{3},ParameterId:{4},ParameterName:{5}", this.GetType().Name, context.GetType().Name, MethodId, BranchId, ParameterId, ParameterName);
                }
                MathNode.LogError(err);
            }
            else
            {
                MethodClass mc = _root.GetCustomMethodById(MethodId);
                if (mc == null)
                {
                    if (_root.ActionInstances != null)
                    {
                        IAction a;
                        if (_root.ActionInstances.TryGetValue(MethodId, out a))
                        {
                            MethodActionForeach ma = a as MethodActionForeach;
                            if (ma != null)
                            {
                                mc = ma;
                            }
                        }
                    }
                }
                if (mc == null)
                {
                    err = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.OnDeserialize(object context): method [{1},{2}] is not found in ClassPointer.  MethodId:{2},BranchId:{3},ParameterId:{4},ParameterName:{5}", this.GetType().Name, _root.ClassId, MethodId, BranchId, ParameterId, ParameterName);
                    MathNode.LogError(err);
                }
                if (mc != null)
                {
                    ActionBranch ab = mc.SearchBranchById(BranchId);
                    if (ab == null)
                    {
                        //throw new DesignerException("{0}.OnDeserialize(object context): Action Branch [{1}] not found in method [{2},{3}][{4}]", this.GetType().Name, BranchId, _root.ClassId, MethodId, mc.Name);
                        mc.AddDeserializer(this);
                    }
                    else
                    {
                        AB_SubMethodAction sma = ab as AB_SubMethodAction;
                        if (sma != null)
                        {
                            _parameter = sma.GetParameterById(ParameterId);
                        }
                        if (_parameter == null)
                        {
                            _parameter = ab.GetActionBranchParameterByName(ParameterName);
                            if (_parameter != null)
                            {
                                _parameter.ParameterID = ParameterId;
                            }
                        }
                    }
                }
            }
        }