Пример #1
0
        /// <summary>
        /// it must be called from a separated app domain other than the designer.
        /// </summary>
        /// <param name="xmlFile"></param>
        public void Load(string xmlFile)
        {
            ProjectEnvironment.RunMode = true;
            XmlDocument doc = new XmlDocument();

            doc.Load(xmlFile);
            XmlNode       _node   = doc.DocumentElement;
            LimnorProject project = new LimnorProject(LimnorProject.GetProjectFileByComponentFile(xmlFile));
            //create root object
            UInt32          classId  = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ClassID);
            UInt32          memberId = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ComponentID);
            ObjectIDmap     map      = new ObjectIDmap(project, DesignUtil.MakeDDWord(memberId, classId), _node);
            XmlObjectReader xr       = new XmlObjectReader(map, ClassPointer.OnAfterReadRootComponent, ClassPointer.OnRootComponentCreated);

            map.SetReader(xr);
            _rootId = new ClassPointer(classId, memberId, map, null);
            string          file   = project.GetComponentFileByClassId(classId);
            ComponentLoader loader = new ComponentLoader(xr, file);
            DesignSurface   ds     = new DesignSurface();

            ds.BeginLoad(loader);
            if (xr.Errors != null && xr.Errors.Count > 0)
            {
                MathNode.Log(xr.Errors);
            }
            _rootId.LoadActionInstances();
        }