public List <ParameterClassSubMethod> GetParameters(AB_SubMethodAction actionBranch) { if (_parameters == null) { CreateParameters(actionBranch); } return(_parameters); }
public override string GetPhpScriptReferenceCode(StringCollection code) { if (this.Method == null) { DesignUtil.WriteToOutputWindowAndLog("GetPhpScriptReferenceCode failed. Method not found. ParameterID:{0}, ActionID:{1}, ClassId:{2}", this.ParameterID, ActionId, this.ClassId); } else { SubMethodInfoPointer smi = this.Method as SubMethodInfoPointer; if (smi == null) { MethodClass mc = this.Method as MethodClass; if (ActionId != 0 && mc != null && mc.ActionList != null) { IAction act = mc.ActionList.GetActionById(ActionId); if (act != null) { smi = act.ActionMethod as SubMethodInfoPointer; } } } if (smi == null) { DesignUtil.WriteToOutputWindowAndLog("GetPhpScriptReferenceCode failed. method [{0}][{1}] found by parameter [{2}] is not a SubMethodInfoPointer", this.Method.MethodName, this.Method.ObjectKey, this.ParameterID); } else { if (this.ActionBranch == null) { MethodClass mc = this.Method as MethodClass; if (mc != null && mc.SubMethod != null && mc.SubMethod.Count > 0) { IMethod0 m0 = mc.SubMethod.Peek(); AB_SubMethodAction asa = m0 as AB_SubMethodAction; if (asa != null) { this.SetActionBranch(asa); } } } if (this.ActionBranch == null) { DesignUtil.WriteToOutputWindowAndLog("GetPhpScriptReferenceCode failed. parameter [{2}] for method [{0}][{1}] missing ActionBranch", this.Method.MethodName, this.Method.ObjectKey, this.ParameterID); } else { SubMethodInfo mi = smi.MethodInformation as SubMethodInfo; string target = smi.Owner.GetPhpScriptReferenceCode(code); return(string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", target, mi.GetIndexCodePHP(smi, this.ActionBranch.BranchId))); } } } return(CodeName); }
protected override void OnEditAction() { MethodDiagramViewer mv = this.DiagramViewer; if (mv != null) { AB_Squential av = this.ActionObject as AB_Squential; MethodDesignerHolder holder = mv.DesignerHolder; MethodClass mc = av.Method; DlgMethod dlg = mc.CreateSubMethodEditor(typeof(ActionGroupDesignerHolder), this.Parent.RectangleToScreen(this.Bounds), mv, av.BranchId); SubMethodInfoPointer smi = null; try { ISingleAction sa = av as ISingleAction; if (sa != null) { smi = sa.ActionData.ActionMethod as SubMethodInfoPointer; if (smi != null) { AB_SubMethodAction smb = this.ActionObject as AB_SubMethodAction; smi.CreateParameters(smb); av.Method.SubMethod.Push(smi); } } // dlg.LoadActions(av); if (_caller == null) { _caller = this.FindForm(); } if (dlg.ShowDialog(_caller) == DialogResult.OK) { AB_SubMethodAction abs = this.ActionObject as AB_SubMethodAction; abs.CopyActionsFrom(dlg.ActionResult, dlg.ComponentIcons); mv.Changed = true; } } catch (Exception err) { MathNode.Log(this.FindForm(), err); } finally { if (smi != null) { if (av.Method.SubMethod.Count > 0) { av.Method.SubMethod.Pop(); } } mc.CurrentSubEditor = null; } } }
public MethodActionForeach(ClassPointer owner) : base(owner) { ActionSubMethodGlobal act = new ActionSubMethodGlobal(owner); act.ActionId = (UInt32)Guid.NewGuid().GetHashCode(); act.ActionType = this.RunAtServer ? EnumWebActionType.Server : EnumWebActionType.Client; act.ActionHolder = this; AB_SubMethodAction ab = new AB_SubMethodAction(act); this.ActionList.Add(ab); }
public void CreateParameters(AB_SubMethodAction actionBranch) { SubMethodInfo sm = (SubMethodInfo)(this.MethodInformation); List <ParameterClassSubMethod> ps = new List <ParameterClassSubMethod>(); ParameterInfo[] info = Info; if (info != null) { for (int i = 0; i < info.Length; i++) { UInt32 pid; pid = (UInt32)info[i].GetHashCode(); ParameterClassSubMethod p = sm.GetParameterType(pid, this, actionBranch); ps.Add(p); } } _parameters = ps; }
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 abstract ParameterClassSubMethod GetParameterType(UInt32 id, SubMethodInfoPointer owner, AB_SubMethodAction action);
public override ParameterClassSubMethod GetParameterType(UInt32 id, SubMethodInfoPointer owner, AB_SubMethodAction action) { ParameterClassSubMethod p; ParameterInfo[] ps = GetParameters(); int i; string s = ((SubMethodParameterInfo)ps[0]).CodeName; UInt32 id0; id0 = (UInt32)(s.GetHashCode()); if (id0 == id) { i = 0; } else { s = ((SubMethodParameterInfo)ps[1]).CodeName; id0 = (UInt32)(s.GetHashCode()); if (id0 == id) { i = 1; } else { i = (int)id; if (i < 0 || i >= ps.Length) { i = 1; } } } if (i == 0) { p = new ParameterClassArrayIndex(ps[i].ParameterType, ps[i].Name, action); } else { p = new ParameterClassArrayItem(ps[i].ParameterType, ps[i].Name, action); } p.ParameterID = id; p.Method = owner; p.ActionId = owner.ActionOwner.ActionId; return(p); }