Ejemplo n.º 1
0
        private void LoadNamedObjects(IElement elementSave)
        {
            if (elementSave == null)
            {
                throw new ArgumentNullException("Argument elementSave is null", "elementSave");
            }

            elementSave.UpdateCustomProperties();

            var layers = elementSave.AllNamedObjects.Where(item=>item.IsLayer);
            var entireFiles = elementSave.AllNamedObjects.Where(item => item.IsEntireFile);
            var everythingElse = elementSave.AllNamedObjects.Where(item => !item.IsLayer && !item.IsEntireFile);

            var ordered = layers.Concat(entireFiles).Concat(everythingElse);

            PositionedObjectList<ElementRuntime> listToPopulate = mContainedElements;
            PositionedObject parentElementRuntime = this;

            CreateNamedObjectElementRuntime(elementSave, CreationOptions.LayerProvidedByContainer, ordered.ToList(), listToPopulate, parentElementRuntime);

            LoadEmbeddedNamedObjects(elementSave, CreationOptions.LayerProvidedByContainer);

            if (elementSave.InheritsFromElement())
            {
                var elementSaveBaseElement = ObjectFinder.Self.GetIElement(elementSave.BaseElement);
                if (elementSaveBaseElement != null)
                {
                    LoadNamedObjects(elementSaveBaseElement);
                }
            }
        }