Beispiel #1
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            SdsiteXmlDocument doc = Service.Sdsite.CurrentDocument;

            ///不创建模板
            if (!newTmpltCheckBox.Checked)
            {
                if ((m_tree.CurrentNode is DataNode) && ((DataNode)m_tree.CurrentNode).NodeType == TreeNodeType.Tmplt)
                {
                    if (_parentEle == null)//如果传入的父元素为空,则父频道为网站根节点
                    {
                        _parentEle = ((ElementNode)m_tree.SelectTreeRootChanNode).Element as FolderXmlElement;
                    }

                    PageSimpleExXmlElement pageEle = doc.CreatePage(_parentEle, PageType.Home, NameTextBox.Text, ((TmpltNode)m_tree.CurrentNode).Element.Id);
                    NewPageId = pageEle.Id;
                }
                else
                {
                    MessageService.Show("请选择模板!");
                    return;
                }
            }
            ///创建页面同时创建模板
            else
            {
                KeyValuePair <string, string> keyvalue = doc.CreateHome(_parentEle, NameTextBox.Text);
                NewPageId = keyvalue.Value;
            }

            this.DialogResult = DialogResult.OK;
            Close();
        }
Beispiel #2
0
        /// <summary>
        /// 新建主页
        /// </summary>
        /// <param name="m_tree"></param>
        internal void NewHome()
        {
            SdsiteXmlDocument             doc        = Service.Sdsite.CurrentDocument;
            BaseFolderElementNode         parentNode = (BaseFolderElementNode)CurrentNode;
            KeyValuePair <string, string> myPair     = doc.CreateHome(parentNode.Element, XmlUtilService.CreateIncreasePageTitle(((BaseFolderElementNode)CurrentNode).Element as FolderXmlElement, PageType.Home));

            Service.Workbench.OpenWorkDocument(WorkDocumentType.TmpltDesigner, myPair.Key);
        }