Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mss"></param>
        /// <returns></returns>
        private List <IRegionDisplay> LoadRegionDisplays(XmlNode regionsNode, IModelSystemStructure mss)
        {
            List <IRegionDisplay> regionDisplays = new List <IRegionDisplay>();

            if (!regionsNode.HasChildNodes)
            {
                return(regionDisplays);
            }

            foreach (XmlNode node in regionsNode.ChildNodes)
            {
                RegionDisplay regionDisplay = new RegionDisplay()
                {
                    Name        = node.Attributes?["Name"].Value,
                    Description = node.Attributes?["Description"]?.Value
                };

                var xmlRegionGroupNodes = node.SelectNodes("RegionGroup");

                if (xmlRegionGroupNodes != null)
                {
                    foreach (XmlNode regionGroupNode in xmlRegionGroupNodes)
                    {
                        RegionGroup regionGroup = new RegionGroup(regionDisplay)
                        {
                            Name = regionGroupNode.Attributes?["Name"].Value
                        };

                        var xmlGroupModuleNodes = regionGroupNode.SelectNodes("Module");

                        if (xmlGroupModuleNodes != null)
                        {
                            foreach (XmlNode moduleNode in xmlGroupModuleNodes)
                            {
                                //get reference to this module
                                string reference            = moduleNode.Attributes?["Reference"].Value;
                                var    modelSystemStructure = GetModuleFromReference(reference, mss);

                                regionGroup.Modules.Add((IModelSystemStructure2)modelSystemStructure);
                            }
                        }

                        regionDisplay.RegionGroups.Add(regionGroup);
                    }
                }

                regionDisplays.Add(regionDisplay);
            }

            return(regionDisplays);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="displays"></param>
        /// <param name="clone"></param>
        /// <returns></returns>
        public static List <IRegionDisplay> MapRegionDisplays(List <IRegionDisplay> displays, IModelSystemStructure clone)
        {
            var list = new List <IRegionDisplay>();

            foreach (var region in displays)
            {
                var r = new RegionDisplay()
                {
                    Name = region.Name
                };

                foreach (var group in region.RegionGroups)
                {
                    var g = new RegionGroup(group, clone, r);


                    r.RegionGroups.Add(g);
                }

                list.Add(r);
            }

            return((List <IRegionDisplay>)list);
        }