Пример #1
0
        public MdiTmpltDesignForm(string tmpltID)
        {
            ResourcesReader.SetControlPropertyHelper(this);
            TmpltID           = tmpltID;
            SnipDesignerForms = new List <Form>();
            InitializeComponent();
            this.ShowIcon = true;
            this.Icon     = Icon.FromHandle(ResourceService.GetResourceImage("tree.img.templet").GetHicon());
            TmpltSimpleExXmlElement tmpltEle = Service.Sdsite.CurrentDocument.GetTmpltElementById(tmpltID);

            if (tmpltEle == null)
            {
                MessageService.Show("文件不存在,打开失败!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                BeginClose();
                return;
            }
            this.Text = tmpltEle.Title;
            Service.Sdsite.CurrentDocument.ElementTitleChanged += new EventHandler <ChangeTitleEventArgs>(CurrentDocument_ElementTitleChanged);
            Service.Workbench.WorkDocumentNewOpened            += new EventHandler <EventArgs <FormData> >(WorkbenchService_WorkDocumentNewOpened);

            Debug.Assert(!string.IsNullOrEmpty(TmpltID));
            TmpltSimpleExXmlElement ele = Service.Sdsite.CurrentDocument.GetTmpltElementById(TmpltID);

            if (ele == null || !File.Exists(ele.AbsoluteFilePath))
            {
                MessageService.Show(StringParserService.Parse("${res:tmpltDesign.tmpltDrawPanel.message.mdiFormLoad}"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                BeginClose();
                return;
            }
            TmpltDoc = ele.GetIndexXmlDocument();

            InitTmpltInfo();
            TmpltDesign.Dock = DockStyle.Fill;
            this.Controls.Add(TmpltDesign);
            TmpltDesign.BringToFront();
        }
Пример #2
0
 public override bool Save()
 {
     TmpltDesign.SaveTmplt(TmpltDoc);
     TmpltDesign.Modified = false;
     return(true);
 }