Пример #1
0
        /// <summary>
        /// 화면을 생성합니다.
        /// </summary>
        /// <returns></returns>
        public ContentControl AddNewScreen()
        {
            var metadata = DesignerManager.GetElementType(typeof(PContentPage));
            var control  = this.GenerateToElement(this, metadata.Element, pushTask: false) as ContentControl;
            var model    = (PContentPage)control.GetRenderer().Model;

            LayoutExtension.SetPageName(
                model,
                $"Screen{Screens?.Count}");

            Keyboard.Focus(this);

            return(control);
        }
Пример #2
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);
        }
Пример #3
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);
        }