protected void SetParameters(List <MethodParamInfoAssist> paramInfos) { if (paramInfos == null) { return; } mParamsPanel?.Children.Clear(); foreach (var paramInfo in paramInfos) { CodeGenerateSystem.Base.BaseNodeControl pc = null; if (paramInfo.ParameterType.IsSubclassOf(typeof(System.Delegate))) { var csParam = new MethodInvoke_DelegateControl.MethodInvoke_DelegateControlConstructionParams() { CSType = mCSParam.CSType, HostNodesContainer = mCSParam.HostNodesContainer, ConstructParam = this.NodeName, ConstructType = MethodInvokeNode.enParamConstructType.MethodOverride, ParamInfo = paramInfo, }; pc = new MethodInvoke_DelegateControl(csParam); } else { if (paramInfo.IsParamsArray) { var csParam = new ParamParameterControl.ParamParameterConstructionParams() { CSType = mCSParam.CSType, HostNodesContainer = mCSParam.HostNodesContainer, ConstructParam = "", ConstructType = MethodInvokeNode.enParamConstructType.MethodOverride, ParamInfo = paramInfo, }; pc = new ParamParameterControl(csParam); } else { var csParam = new MethodInvokeParameterControl.MethodInvokeParameterConstructionParams() { CSType = mCSParam.CSType, HostNodesContainer = mCSParam.HostNodesContainer, ConstructParam = "", ConstructType = MethodInvokeNode.enParamConstructType.MethodOverride, ParamInfo = paramInfo, }; pc = new MethodInvokeParameterControl(csParam); } } //pc.SetToolTip(EngineNS.Rtti.AttributeHelper.GetCustomAttributePropertyValue(paramInfo, typeof(DescriptionAttribute).FullName, "Description", false)); AddChildNode(pc, mParamsPanel); } }
// 这里不做参数在PropertyGrid中的显示设置,防止类似Ref参数被无意设置 protected void SetParameters(MethodInfoAssist methodInfo) { var cpInfos = new List <CustomPropertyInfo>(); mParamsPanel?.Children.Clear(); var param = CSParam as ReturnConstructParam; // return if ((param.MethodInfo.ReturnType != typeof(void)) && (param.MethodInfo.ReturnType != typeof(System.Threading.Tasks.Task))) { var csParam = new MethodInvokeParameterControl.MethodInvokeParameterConstructionParams() { CSType = CSParam.CSType, HostNodesContainer = CSParam.HostNodesContainer, ConstructParam = "", ConstructType = MethodInvokeNode.enParamConstructType.Return, ParamInfo = new MethodParamInfoAssist() { FieldDirection = System.CodeDom.FieldDirection.Out, IsParamsArray = false, ParameterType = param.MethodInfo.ReturnType, ParamName = "Return", }, }; var ctrl = new MethodInvokeParameterControl(csParam); AddChildNode(ctrl, mParamsPanel); if (Program.IsTypeValidInPropertyGridShow(param.MethodInfo.ReturnType)) { var cpInfo = Program.GetFromParamInfo(csParam.ParamInfo); cpInfos.Add(cpInfo); } } foreach (var methodParam in methodInfo.Params) { if (methodParam.FieldDirection != System.CodeDom.FieldDirection.Out) { continue; } CodeGenerateSystem.Base.BaseNodeControl pc = null; if (methodParam.ParameterType.IsSubclassOf(typeof(System.Delegate))) { var csParam = new MethodInvoke_DelegateControl.MethodInvoke_DelegateControlConstructionParams() { CSType = CSParam.CSType, HostNodesContainer = CSParam.HostNodesContainer, ConstructParam = this.NodeName, ConstructType = MethodInvokeNode.enParamConstructType.Return, ParamInfo = methodParam, }; pc = new MethodInvoke_DelegateControl(csParam); } else { if (methodParam.IsParamsArray) { var csParam = new ParamParameterControl.ParamParameterConstructionParams() { CSType = CSParam.CSType, HostNodesContainer = CSParam.HostNodesContainer, ConstructParam = "", ConstructType = MethodInvokeNode.enParamConstructType.Return, ParamInfo = methodParam, }; pc = new ParamParameterControl(csParam); } else { var csParam = new MethodInvokeParameterControl.MethodInvokeParameterConstructionParams() { CSType = CSParam.CSType, HostNodesContainer = CSParam.HostNodesContainer, ConstructParam = "", ConstructType = MethodInvokeNode.enParamConstructType.Return, ParamInfo = methodParam, }; pc = new MethodInvokeParameterControl(csParam); if (Program.IsTypeValidInPropertyGridShow(methodParam.ParameterType)) { var cpInfo = Program.GetFromParamInfo(methodParam); cpInfos.Add(cpInfo); } } } AddChildNode(pc, mParamsPanel); } CreateTemplateClass(cpInfos); }