Beispiel #1
0
        private bool LoadServerComponents()
        {
            try
            {
                ServerComponents.Clear();

                var componentFile = packageFiles
                                    .FirstOrDefault(pf => pf.Name == ServerComponentPackageFile.FileName);

                if (componentFile != null)
                {
                    var reader = new ObjectXmlReader(componentFile.Stream);

                    var container = reader.ReadObject() as ObjectContainer <PComponent>;

                    this.ServerComponents.AddRange(container.Items);

                    // Binder Cache
                    foreach (PComponent c in container.Items)
                    {
                        CachingBinder(c);
                    }
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Beispiel #2
0
        private bool LoadRenderers()
        {
            try
            {
                var rendererFiles = packageFiles
                                    .Where(pf => pf.Name.IsMatch($"^{PageRendererPackageFile.Path}/.+"));

                foreach (PackageFile file in rendererFiles)
                {
                    var reader = new ObjectXmlReader(file.Stream);

                    var container = reader.ReadObject() as ObjectContainer <RendererSurface>;

                    foreach (var r in container.Items)
                    {
                        rendererInfos[r.Guid] = r;
                    }
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Beispiel #3
0
        private bool LoadTemplates()
        {
            try
            {
                Templates.Clear();

                var templateFiles = packageFiles
                                    .Where(pf => pf.Name.IsMatch($"^{TemplatePackageFile.Path}/.+"));

                foreach (PackageFile file in templateFiles)
                {
                    string name   = Path.GetFileNameWithoutExtension(file.Name);
                    var    reader = new ObjectXmlReader(file.Stream);

                    object model = reader.ReadObject();

                    if (model is PTemplatePage page)
                    {
                        if (string.IsNullOrEmpty(name))
                        {
                            name = LayoutExtension.CreatePageName(page, "Template");
                        }

                        // Name Setting
                        LayoutExtension.SetPageName(page, name);

                        Templates.Add(page);

                        CachingBinder(page.Binder);

                        foreach (var node in ObjectContentTreeHelper.FindContentChildrens <PVisual, PVisual>(page))
                        {
                            CachingBinder(node.Child.Binder);
                        }
                    }
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Beispiel #4
0
        private bool LoadComponents()
        {
            try
            {
                var componentFile = packageFiles
                                    .FirstOrDefault(pf => pf.Name == ComponentPackageFile.FileName);

                var expressionFile = packageFiles
                                     .FirstOrDefault(pf => pf.Name == ComponentExpressionPackageFile.FileName);

                if (componentFile != null)
                {
                    var reader = new ObjectXmlReader(componentFile.Stream);

                    var container = reader.ReadObject() as ObjectContainer <PComponent>;

                    this.Components.AddRange(container.Items);

                    // Binder Cache
                    foreach (PComponent c in container.Items)
                    {
                        CachingBinder(c);
                    }
                }

                if (expressionFile != null)
                {
                    var reader = new ObjectXmlReader(expressionFile.Stream);

                    var container = reader.ReadObject() as ObjectContainer <BindExpression>;

                    bindExpressions = container.Items;
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Beispiel #5
0
        private bool LoadScreens()
        {
            try
            {
                Screens.Clear();
                Components.Clear();

                var screenFiles = packageFiles
                                  .Where(pf => pf.Name.IsMatch($"^{ScreenPackageFile.Path}/.+"));

                foreach (PackageFile file in screenFiles)
                {
                    string name   = Path.GetFileNameWithoutExtension(file.Name);
                    var    reader = new ObjectXmlReader(file.Stream);

                    object model = reader.ReadObject();

                    if (model is PContentPage page)
                    {
                        // Name Setting
                        LayoutExtension.SetPageName(page, name);

                        Screens.Add(page);

                        CachingBinder(page.Binder);

                        foreach (var node in ObjectContentTreeHelper.FindContentChildrens <PVisual, PVisual>(page))
                        {
                            CachingBinder(node.Child.Binder);
                        }
                    }
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }
Beispiel #6
0
        private bool LoadExpressions()
        {
            try
            {
                var expressionFile = packageFiles
                                     .FirstOrDefault(pf => pf.Name == ComponentExpressionPackageFile.FileName);

                if (expressionFile != null)
                {
                    var reader = new ObjectXmlReader(expressionFile.Stream);

                    var container = reader.ReadObject() as ObjectContainer <BindExpression>;

                    bindExpressions = container.Items;
                }

                return(true);
            }
            catch
            {
            }

            return(false);
        }