Esempio n. 1
0
        private static LabelGroup ElementToLabelGroup(XmlElement labelGroupEle, string fieldId)
        {
            if (labelGroupEle == null)
            {
                return(null);
            }
            String     name      = XmlUtils.GetAttributeValue(labelGroupEle, "name");
            LabelGroup lg_result = new LabelGroup();

            lg_result.Name = name;
            List <XmlElement> labelEleList = XmlUtils.GetChildElements(labelGroupEle, "label");

            foreach (XmlElement labelEle in labelEleList)
            {
                Label  label      = new Label();
                String labelName  = XmlUtils.GetAttributeValue(labelEle, "name");
                String labelValue = XmlUtils.GetAttributeValue(labelEle, "value");
                String labelDesc  = XmlUtils.GetAttributeValue(labelEle, "desc");
                label.Name  = labelName;
                label.Value = labelValue;
                label.Desc  = labelDesc;
                lg_result.Add(label);
            }
            List <XmlElement> labelGroupEleList = XmlUtils.GetChildElements(labelGroupEle, "label-group");

            foreach (XmlElement subLabelGroupEle in labelGroupEleList)
            {
                LabelGroup subGroup = new LabelGroup();
                subGroup = ElementToLabelGroup(subLabelGroupEle, fieldId);
                lg_result.Add(subGroup);
            }
            return(lg_result);
        }
Esempio n. 2
0
        public Label AddLabel(string name, string value, string desc)
        {
            Label label = new Label();

            label.Name  = name;
            label.Value = value;
            label.Desc  = desc;
            labelGroup.Add(label);
            return(label);
        }