void createParamEditor(MethodDef method, bool enable, bool bReadonlyParent) { List <MethodDef.Param> parameters = method.Params; foreach (MethodDef.Param p in parameters) { Type editorType = typeof(DesignerParameterComboEnumEditor); string arugmentsName = " " + p.DisplayName; bool bReadonly = bReadonlyParent | p.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly); Label label = propertyGrid.AddProperty(arugmentsName, editorType, bReadonly); label.MouseEnter += new EventHandler(label_MouseEnter); DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; if (p.Type.Name == "IList") { lastListParam = p; } if (p.Type.Name == "System_Object" && lastListParam != null) { p.ListParam = lastListParam; } editor.Enabled = enable; editor.SetParameter(p, _selectedObject, bReadonly); editor.ValueWasAssigned(); editor.MouseEnter += editor_MouseEnter; editor.DescriptionWasChanged += editor_DescriptionWasChanged; editor.ValueWasChanged += editor_ValueWasChanged; //editor.ValueType = p.Attribute.ValueType; MethodDef.Param arrayIndexElement = null; if (p.Value is VariableDef) { VariableDef var = p.Value as VariableDef; arrayIndexElement = var.ArrayIndexElement; } else if (p.Value is RightValueDef) { RightValueDef varRV = p.Value as RightValueDef; if (varRV.Var != null) { arrayIndexElement = varRV.Var.ArrayIndexElement; } } if (arrayIndexElement != null) { createArrayIndexEditor(" ", arrayIndexElement); } } }
void createArrayIndexEditor(string preBlank, MethodDef.Param arrayIndex) { Type editorType = typeof(DesignerParameterComboEnumEditor); string arugmentsName = preBlank + "Index"; bool bReadonly = false; Label label = propertyGrid.AddProperty(arugmentsName, editorType, bReadonly); label.MouseEnter += new EventHandler(label_MouseEnter); DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; editor.Enabled = true; editor.SetParameter(arrayIndex, _selectedObject, bReadonly); editor.ValueWasAssigned(); editor.MouseEnter += editor_MouseEnter; editor.DescriptionWasChanged += editor_DescriptionWasChanged; editor.ValueWasChanged += editor_ValueWasChanged; }
void createParamEditor(MethodDef method, bool enable) { List <MethodDef.Param> parameters = method.Params; foreach (MethodDef.Param p in parameters) { Type editorType = typeof(DesignerParameterComboEnumEditor); string arugmentsName = " " + p.DisplayName; Label label = propertyGrid.AddProperty(arugmentsName, editorType, p.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly)); label.MouseEnter += new EventHandler(label_MouseEnter); DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; editor.Enabled = enable; editor.SetParameter(p, _selectedObject); editor.ValueWasAssigned(); editor.MouseEnter += editor_MouseEnter; editor.DescriptionWasChanged += editor_DescriptionWasChanged; editor.ValueWasChanged += editor_ValueWasChanged; } }