Пример #1
0
        /// <summary>
        /// 修改NODE显示的TEXT
        /// </summary>
        /// <param name="strNewText"></param>
        public virtual void ChangeNodeText(string strNewText)
        {//对节点重命名暂时仅支持页面片的重命名!
            TmpltBaseTreeNode tmpltBaseTreeNode = this;

            //找到对应的模板1
            while (!(tmpltBaseTreeNode is TmpltElementNode))
            {
                tmpltBaseTreeNode = (TmpltBaseTreeNode)tmpltBaseTreeNode.Parent;
            }

            TmpltSimpleExXmlElement tmpltElement = tmpltBaseTreeNode.Element as TmpltSimpleExXmlElement;

            //得到对应的模板文件DOC
            TmpltXmlDocument tmpltDocument = tmpltElement.GetIndexXmlDocument();

            if (this is SnipElementNode)
            {
                SnipXmlElement snipElement = ((this as SnipElementNode).Element) as SnipXmlElement;
                snipElement.SnipName = strNewText;

                //通知页面设计器,更改FORM的TEXT
                string[] strArray = new string[2];
                strArray[0] = snipElement.Id;
                strArray[1] = strNewText;
                SdsiteXmlDocument.OnSnipDesignerFormTextChange(new EventArgs <string[]>(strArray));
            }
        }
Пример #2
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();
        }