private JObject GetElement(UiElementContainerSpec container, UiElementSpec elementSpec) { JObject item = null; var pcs = elementSpec as ParameterControlSpec; if (pcs != null) { item = GetParameter(container, pcs); } else if (elementSpec is PictureControlSpec) { item = GetPicture(container, (PictureControlSpec)elementSpec); } else { var subContainer = elementSpec as UiElementContainerSpec; if (subContainer != null) { var group = subContainer as ControlSpecGroupBase; if (group != null) { item = GetGroupItems(group, null); } else if (subContainer is ControlRowSpec) { item = GetGroupItems(container, subContainer); } else { var pictureFolderSpec = subContainer as PictureFolderSpec; if (pictureFolderSpec != null) { item = GetPictureFolder(container, pictureFolderSpec); } } } } if (item == null) { item = new JObject(); } item.Add("name", elementSpec.Name); item.Add("tooltip", elementSpec.ToolTip); item.Add("displayName", elementSpec.DisplayName); item.Add("type", elementSpec.GetType().Name); return(item); }
private void ProcessElement(UiElementContainerSpec container, UiElementSpec elementSpec) { switch (elementSpec) { case ParameterControlSpec parameterControlSpec: ProcessParameter(parameterControlSpec); break; case UiElementContainerSpec subContainer: switch (subContainer) { case ControlSpecGroupBase controlGroup: ProcessGroup(controlGroup); break; case ControlRowSpec _: ProcessGroup(container, subContainer); break; } break; } }