Exemplo n.º 1
0
        public IMasterPage CreateMasterPage(ISerializeWriter writer, string pageName, Stream thumbnail)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            CheckOpen();

            IMasterPage newMasterPage = CreateMasterPage(pageName);

            newMasterPage.Open();

            PageView         baseView  = newMasterPage.PageViews[AdaptiveViewSet.Base.Guid] as PageView;
            IObjectContainer container = baseView.AddObjects(writer.WriteToStream());

            // Adjust widgets position from coordinate (0,0);
            baseView.PageViewStyle.X = 0;
            baseView.PageViewStyle.Y = 0;

            if (thumbnail != null)
            {
                newMasterPage.Thumbnail = thumbnail;
            }

            newMasterPage.Close();

            return(newMasterPage);
        }
Exemplo n.º 2
0
        internal static CustomObjectPage CreateCustomObject(Document document, ISerializeWriter writer,
                                                            string objectName, Stream icon, Stream thumbnail)
        {
            CustomObjectPage objectPage = document.CreatePage(objectName) as CustomObjectPage;

            // Create a new node in the page tree.
            ITreeNode node = document.DocumentSettings.LayoutSetting.PageTree.AddChild(TreeNodeType.Page);

            node.AttachedObject = objectPage;

            objectPage.Open();

            // Add to base view.
            PageView         baseView  = objectPage.PageViews[document.AdaptiveViewSet.Base.Guid] as PageView;
            IObjectContainer container = baseView.AddObjects(writer.WriteToStream());

            // Adjust widgets position from coordinate (0,0);
            baseView.PageViewStyle.X = 0;
            baseView.PageViewStyle.Y = 0;

            if (icon != null)
            {
                objectPage.Icon = icon;
            }

            if (thumbnail != null)
            {
                objectPage.Thumbnail = thumbnail;
            }

            // Page must be closed after setting icon and thumbnail, so that they can be saved into the file.
            // Document.save() only call save() on opened pages.
            objectPage.Close();

            document.UpdateLastAccessTime();

            return(objectPage);
        }