Exemple #1
0
        private static RenderBase generateViewByPath(String path, RenderBase parent = null)
        {
            String   absPath = UIProject.Instance().GetRealFile(path);
            String   content = FileHelper.GetFullContent(absPath);
            XElement xml     = XmlHelper.Parse(content);

            if (xml == null)
            {
                return(null);
            }
            if (parent != null && path.Length > 0 && parent.checkParentPathNest(UIProject.Instance().GetRelativePath(absPath)))
            {
                throw new NestException(UIProject.Instance().GetRelativePath(absPath));
            }
            xml.SetAttributeValue("Name", Constant.TypePanel);
            RenderBase render = generateViewByXml(xml, parent);

            if (render is TDPanel)
            {
                (render as TDPanel).panelPath = UIProject.Instance().GetRelativePath(absPath);
            }
            return(render);
        }
Exemple #2
0
        private static RenderBase generateViewByXml(XElement xml, RenderBase parent)
        {
            if (xml == null)
            {
                return(null);
            }
            RenderBase item = null;

            String name = XmlHelper.GetString(xml, "Name");
            String path = XmlHelper.GetString(xml, "Path");

            if (name.Length > 0)
            {
                if (parent != null && path.Length > 0 && parent.checkParentPathNest(path))
                {
                    throw new NestException(UIProject.Instance().GetRelativePath(path));
                }
                item = generateItemByName(name, path, parent);
                if (item == null)
                {
                    return(item);
                }
                item.getAttrByXml(xml);
                //XElement child = xml.Element("Child");
                //if (child != null)
                //{
                //    foreach (XElement element in child.Elements("Node"))
                //    {
                //        generateViewByXml(element, item);
                //    }
                //}
                item.loadComplete();
            }

            return(item);
        }