示例#1
0
        public static FieldControl CreateControl(IXmlElement parent, XElement xElem)
        {
            if (xElem == null)
            {
                log.Debug("xElem is null! parent=" + parent.ToXml());
                return null;
            }

            string typeName = xElem.Attribute("type").Value;
            if (!typeName.StartsWith("AgileEAP.EForm"))
                typeName = string.Format("AgileEAP.EForm.{0}", typeName);

            FieldControl control = null;
            try
            {
                control = Activator.CreateInstance(Type.GetType(typeName), new object[] { parent, xElem }) as FieldControl;
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

            return control;
        }