Beispiel #1
0
        /// <summary>
        /// 保存当前页面数据到xml中
        /// </summary>
        public void saveSelf()
        {
            if (!_isModify)
            {
                return;
            }

            SVXml xml = new SVXml();

            xml.createRootEle("Page");
            saveXML(xml);
            xml.writeXml(pageFileName);
        }
        /// <summary>
        /// 确定
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        private void okBtn_Click(object sender, EventArgs e)
        {
            SVPageNode node = _svTreeView.SelectedNode as SVPageNode;

            if (node == null || node.Level != 2)
            {
                SVMessageBox msgBox = new SVMessageBox();
                msgBox.content(Resource.提示, Resource.请选择页面);
                msgBox.ShowDialog();
                return;
            }

            SVPageWidget widget = node.Addtionobj as SVPageWidget;
            ///模板文件
            String file = Path.Combine(SVProData.TemplatePath, node.Text);

            if (File.Exists(file))
            {
                SVMessageBox msgBox = new SVMessageBox();
                msgBox.content(Resource.提示, node.Text + " " + Resource.模板已经存在);
                msgBox.ShowDialog();
                return;
            }

            //保存文件
            SVXml pageXML = new SVXml();

            pageXML.createRootEle("Page");
            widget.saveXML(pageXML);
            pageXML.writeXml(file);

            //保存缩略图
            Bitmap ctlbitmap = new Bitmap(widget.Width, widget.Height);

            widget.DrawToBitmap(ctlbitmap, widget.ClientRectangle);
            ctlbitmap.Save(file + ".jpg");

            //记录日志
            SVLog.WinLog.Info(String.Format("模板{0}保存成功", node.Text));

            this.DialogResult = System.Windows.Forms.DialogResult.Yes;
        }