Esempio n. 1
0
        public static ZApplication Load(XmlDocument xmlDocument, ZTreeView treeView)
        {
            _treeView = treeView;
            if (treeView != null) treeView.Nodes.Clear();            

            ZApplication app = new ZApplication();            
            _unresolved = new List<Unresolved>();

            XmlNode rootElement = xmlDocument.DocumentElement;
            if (rootElement != null)
            {                
                if (treeView != null)                
                    ProcessNode(app, null, treeView.Nodes, rootElement);
                else
                    ProcessNode(app, null, null, rootElement);
            }
            foreach(var unres in _unresolved)
            {
                ZComponent target = ZComponent.App.Find(unres.value);
                if (target != null)                                   
                    unres.prop.SetValue(unres.comp, target);                
                else
                    Console.WriteLine("Unresolved field: {0} - {1}", unres.prop.FieldType.Name, unres.value);
            }
            _unresolved.Clear();
            if (treeView != null)
            {
                treeView.xmlDocument = xmlDocument;
                treeView.ExpandAll();
                treeView.Invalidate();
            }

            return app;
        }
Esempio n. 2
0
        public static Project CreateProject(string filePath, ZTreeView treeView)
        {
            Project project = new Project(filePath);
            project.LoadXml();
            project.app = Load(project.xmlDoc, treeView);             

            return project;
        }
Esempio n. 3
0
        public void FillTreeView(ZTreeView treeView)
        {
            this.treeView = treeView;
            treeView.SetProject(this);

            treeView.Nodes.Clear();

            XmlNode rootElement = xmlDoc.DocumentElement;
            if (rootElement != null)
                ProcessNode(app, null, 0, treeView.Nodes, rootElement);

            if (treeView != null)
            {
                treeView.xmlDocument = xmlDoc;
                treeView.ExpandAll();
                treeView.Invalidate();
            }
        }
Esempio n. 4
0
        public bool RecompileApplication(CodeGenerator codeGen, ZTreeView treeView)
        {
            if (xmlDoc == null || app == null) return false;
            ZApplication newApp = codeGen.RecompileApplication(xmlDoc, nodeMap, app);
            if (newApp != null)
            {
                app = newApp;
                
                //if (treeView != null) FillTreeView(treeView);

                return true;
            }
            return false;
        }
Esempio n. 5
0
 public void Reset(ZTreeView treeView, CodeGenerator codeGen)
 {
     app = null;
     BuildApplication(codeGen);
     if (treeView != null) FillTreeView(treeView);
 }
Esempio n. 6
0
        public static Project CreateProject(string filePath, ZTreeView treeView, CodeGenerator codeGen)
        {
            Project project = new Project(filePath);
            project.LoadXml();
            project.BuildApplication(codeGen);
            if (treeView != null) project.FillTreeView(treeView);

            return project;
        }