Пример #1
0
        public TmpltDesignerPanel(int width, int height, Image backImage, TmpltXmlDocument doc)
            : base(width, height, backImage)
        {
            _backImg = backImage;
            TmpltID  = doc.Id;
            InitializeComponent();
            InitEvents();
            TmpltDoc = doc;
            LoadTmplt(doc);

            strRectsData = TmpltDoc.GetRectsElement().InnerXml;
        }
Пример #2
0
        private void TmpltHtmlCreator(TmpltXmlDocument tmpltdoc)
        {
            this.codeTextBox.Clear();
            this.outXmlTextBox.Clear();
            this.tree.Nodes.Clear();

            string source = tmpltdoc.GetRectsElement().OuterXml.Replace(">", ">\r\n");

            if (tmpltdoc.SaveXhtml(this._htmlHelper))
            {
                string html = File.ReadAllText(tmpltdoc.HtmlFile).Replace(">", ">\r\n");
                this.codeTextBox.Text = html;
            }

            this.outXmlTextBox.Text = source;

            TreeNode treenode = new TreeNode();

            this.SetTmpltTree(tmpltdoc.GetRectsElement(), treenode);
            this.tree.Nodes.Add(treenode);
            this.tree.ExpandAll();
        }
Пример #3
0
        /// <summary>
        /// 保存模板
        /// </summary>
        public void SaveTmplt(TmpltXmlDocument doc)
        {
            if (doc.HasContentSnip != HasContentSnip)
            {
                TmpltDoc.HasContentSnip = HasContentSnip;
                Internal.InternalService.OnTmpltDocumentHealthChanged(new EventArgs <string>(TmpltID));
            }
            float x = DrawPanel.CurZoom;

            DrawPanel.CurZoom = 1;

            SaveLines();
            SaveRects();

            DrawPanel.CurZoom = x;

            doc.Save();

            //保存XML文档内容,如果恢复的话这里就是起点
            strRectsData = doc.GetRectsElement().InnerXml;
        }
Пример #4
0
        public override bool CannelSave()
        {
            if (string.IsNullOrEmpty(TmpltDesign.strRectsData))
            {
                return(false);
            }

            //得到该模板对应的 TmpltSimpleExXmlElement
            TmpltSimpleExXmlElement ele = Service.Sdsite.CurrentDocument.GetTmpltElementById(TmpltID);

            if (ele != null)
            {
                TmpltXmlDocument tmpltDoc = Service.Sdsite.CurrentDocument.GetTmpltDocumentById(TmpltID);


                tmpltDoc.DocumentElement.RemoveChild(tmpltDoc.GetRectsElement());

                XmlElement newRects = tmpltDoc.CreateElement("rects");
                newRects.InnerXml = TmpltDesign.strRectsData;
                tmpltDoc.DocumentElement.AppendChild(newRects);
            }
            return(true);
        }