private void ProssShowAll(BaseFolderElementNode folderNode) { //try //{ // string[] files = Directory.GetFiles(folderNode.Element.AbsoluteFilePath); // foreach (string file in files) // { // string id = Utility.File.GetXmlDocumentId(file); // string exName = Path.GetExtension(file); // SdsiteXmlDocument doc = Service.Sdsite.CurrentDocument; // AnyXmlElement ele = doc.GetElementById(id); // if (ele == null || ((SimpleExIndexXmlElement)ele).IsExclude) // { // FileOutsideNode outNode = new FileOutsideNode(file); // outNode.Text = Path.GetFileNameWithoutExtension(file); // folderNode.Nodes.Add(outNode); // SimpleExIndexXmlElement newEle = null; // if (ele == null) // { // switch (exName) // { // case Utility.Const.PageFileExt: // { // //Service.Sdsite.CurrentDocument.CreatePage() // //newEle = new PageSimpleExXmlElement(); // //newEle.Id = Guid.NewGuid().ToString("N"); // break; // } // } // folderNode.Element.AppendChild(newEle); // } // } // } // string[] Directories = Directory.GetDirectories(folderNode.Element.AbsoluteFilePath); // foreach (SimpleExIndexXmlElement Dir in folderNode.Element.ChildNodes) // { // if (Dir is FolderXmlElement && Dir.IsExclude) // { // FolderOutsideNode outNode = new FolderOutsideNode(Dir.AbsoluteFilePath); // outNode.Text = Path.GetFileName(Path.GetDirectoryName(Dir.AbsoluteFilePath)); // folderNode.Nodes.Add(outNode); // } // } // TreeNodeCollection childFolderNodes = folderNode.Nodes; // foreach (TreeNode childFolder in childFolderNodes) // { // if (childFolder is BaseFolderElementNode) // ProssShowAll(childFolder as BaseFolderElementNode); // } //} //catch //{ //} }
/// <summary> /// 新建文件夹 /// </summary> /// <param name="m_tree"></param> internal void NewFolder() { string title = XmlUtilService.CreateIncreaseFolderTitle(((BaseFolderElementNode)CurrentNode).Element as FolderXmlElement); SdsiteXmlDocument doc = Service.Sdsite.CurrentDocument; BaseFolderElementNode parentNode = (BaseFolderElementNode)CurrentNode; doc.CreateFolder(parentNode.Element.Id, title); }
private ElementNode AddElementNode(SimpleExIndexXmlElement element) { ///找到新Element的父Element在树中的节点 BaseFolderElementNode folderNode = (BaseFolderElementNode)GetElementNode(element.OwnerFolderElement.Id); ///添加此SimpleExIndexXmlElement return(folderNode.AddElementNode(element)); }
/// <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); }
/// <summary> /// 新增频道 /// </summary> /// <param name="m_tree"></param> public void NewChannel() { string title = XmlUtilService.CreateIncreaseChannelTitle(((BaseFolderElementNode)CurrentNode).Element as FolderXmlElement); SdsiteXmlDocument doc = Service.Sdsite.CurrentDocument; BaseFolderElementNode parentNode = (BaseFolderElementNode)this.CurrentNode; doc.CreateChannel(parentNode.Element.Id, title); }
private void ProssUnShowAll(BaseFolderElementNode folderNode) { foreach (BaseTreeNode node in folderNode.Nodes) { if (node is OutsideNode) { node.Parent.RemoveChildNode(node); } else if (node is BaseFolderElementNode) { ProssUnShowAll(node as BaseFolderElementNode); } } }
/// <summary> /// 导入资源文件 /// </summary> public void ImportResource() { SdsiteXmlDocument doc = Service.Sdsite.CurrentDocument; FormOpenFileDialog OpenFile = new FormOpenFileDialog(); OpenFile.OpenDialog.Multiselect = true; OpenFile.OpenDialog.Filter = "PIC files (*.jpg,*.png,*.gif)|*.jpg;*.png;*.gif;|Flash files (.swf)|*.swf|Media files (*.rmvb,*.rm,*.avi,*.wmv)|*.rmvb;*.rm;*.avi;*.wmv|Audio files (*.mp3,*.mdi,*.wma,*.wav)|*.mp3;*.mid;*.wma;*.wav"; BaseFolderElementNode pathNode = CurrentNode as BaseFolderElementNode; string parentFolderID = ((ElementNode)CurrentNode).Element.Id; if (OpenFile.ShowDialog(this) == DialogResult.OK) { string[] fileNames = OpenFile.OpenDialog.FileNames; foreach (string srcFilePath in fileNames) { FileSimpleExXmlElement fileEle = doc.CreateFileElement(parentFolderID, srcFilePath); } } }
//TODO:菜单的执行事件 static void AllMenuClick(object sender, EventArgs e) { MyMenuItem item = sender as MyMenuItem; if (item == null) { return; } ///检查其Enabled状态 if (!MenuStateManager.GetAndSetMenuEnabled(item.KeyId)) { return; } switch (item.KeyId) { #region 新建页面 case "MainMenu.file.newFile.page.index": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.Home); break; } #endregion case "MainMenu.file.newFile.page.general": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.General); break; } #endregion case "MainMenu.file.newFile.page.hr": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.Hr); break; } #endregion case "MainMenu.file.newFile.page.inviteBidding": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.InviteBidding); break; } #endregion case "MainMenu.file.newFile.page.knowledge": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.Knowledge); break; } #endregion case "MainMenu.file.newFile.page.product": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.Product); break; } #endregion case "MainMenu.file.newFile.page.project": #region { BaseFolderElementNode rootChannelNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewPage(rootChannelNode.Element, PageType.Project); break; } #endregion #endregion #region 新建模板 case "MainMenu.file.newFile.tmplt.index": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.Home); break; } #endregion case "MainMenu.file.newFile.tmplt.general": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.General); break; } #endregion case "MainMenu.file.newFile.tmplt.hr": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.Hr); break; } #endregion case "MainMenu.file.newFile.tmplt.inviteBidding": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.InviteBidding); break; } #endregion case "MainMenu.file.newFile.tmplt.knowledge": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.Knowledge); break; } #endregion case "MainMenu.file.newFile.tmplt.product": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.Product); break; } #endregion case "MainMenu.file.newFile.tmplt.project": #region { BaseFolderElementNode tmpltRootNode = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.SiteManagerNode.RootChannelNode.TmpltRootNode; WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree.NewTmplt(tmpltRootNode.Element, TmpltType.Project); break; } #endregion #endregion case "MainMenu.file.new": #region { Service.Workbench.ShowDialogForCreateProject(); break; } #endregion case "MainMenu.file.open": #region { Service.Workbench.ShowDialogForOpenProject(); break; } #endregion case "MainMenu.file.close": #region if (WorkbenchForm.MainForm.MainDockPanel.ActiveDocument != null) { WorkbenchForm.MainForm.MainDockPanel.ActiveDocument.DockHandler.Close(); } break; #endregion case "MainMenu.file.closeProj": #region { Service.Project.CloseProject(); break; } #endregion case "MainMenu.file.save": #region Save(); break; #endregion case "MainMenu.file.saveAll": #region SaveAll(); break; #endregion case "MainMenu.file.pub": #region ///先保存全部 SaveAll(); ///检查并提示网站是否有主页 if (!Service.Sdsite.CurrentDocument.RootChannel.HasEffectiveDefaultPage) { if (MessageService.Show("没有为网站设置主页,发布后的网站将没有主页。\r\n\r\n是否确定现在发布?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } Publish publish = new Publish(); publish.ExecutePublish(); break; #endregion case "MainMenu.file.opennet": #region string url = @"http://{0}.{1}.{2}"; url = string.Format(url, Service.Sdsite.CurrentDocument.SdsiteName, Service.User.UserID, "SimplusD.net"); Process.Start(url); break; #endregion case "MainMenu.file.preview": #region ///先保存 SaveAll(); Service.WebView.StartupProcess(); break; #endregion case "MainMenu.file.exit": #region //System.Windows.Forms.Application.Exit(); WorkbenchForm.MainForm.Close(); break; #endregion case "MainMenu.edit.undo": #region { WorkbenchForm.MainForm.ActiveView.Undo(); break; } #endregion case "MainMenu.edit.redo": #region { WorkbenchForm.MainForm.ActiveView.Redo(); break; } #endregion case "MainMenu.edit.find": #region { FindOptions.Singler.Reset(); //FindAndReplaceForm.Initialize(WorkbenchForm.MainForm); FindAndReplaceForm findForm = new FindAndReplaceForm(true); findForm.Owner = _mainForm; findForm.Show(); break; } #endregion case "MainMenu.edit.replace": #region FindOptions.Singler.Reset(); // FindAndReplacePad.Initialize(WorkbenchForm.MainForm); FindAndReplaceForm replaceForm = new FindAndReplaceForm(false); replaceForm.Owner = _mainForm; replaceForm.Show(); break; #endregion case "MainMenu.edit.findNext": #region { FindOptions.Singler.Reset(); //FindAndReplacePad.Initialize(WorkbenchForm.MainForm); FindAndReplaceForm findForm = new FindAndReplaceForm(true); findForm.Owner = _mainForm; findForm.Show(); break; } #endregion case "MainMenu.edit.cut": #region { WorkbenchForm.MainForm.ActiveView.Cut(); break; } #endregion case "MainMenu.edit.copy": #region { WorkbenchForm.MainForm.ActiveView.Copy(); break; } #endregion case "MainMenu.edit.paste": #region { WorkbenchForm.MainForm.ActiveView.Paste(); break; } #endregion case "MainMenu.edit.delete": #region { WorkbenchForm.MainForm.ActiveView.Delete(); break; } #endregion case "MainMenu.edit.selectAll": #region { WorkbenchForm.MainForm.ActiveView.SelectAll(); break; } #endregion case "MainMenu.edit.option": #region { SoftwareOptionForm form = new SoftwareOptionForm(); form.ShowDialog(); break; } #endregion case "MainMenu.view.wizard": #region WorkbenchForm.MainForm.DeHideAllPad(); WorkbenchForm.MainForm.MainWizardPad.Show(); break; #endregion case "MainMenu.view.property": #region WorkbenchForm.MainForm.DeHideAllPad(); WorkbenchForm.MainForm.MainPropertyPad.Show(); break; #endregion case "MainMenu.view.result": #region WorkbenchForm.MainForm.DeHideAllPad(); WorkbenchForm.MainForm.MainResultPad.Show(); break; #endregion case "MainMenu.view.siteManager": #region WorkbenchForm.MainForm.DeHideAllPad(); WorkbenchForm.MainForm.MainTreePad.Show(); break; #endregion case "MainMenu.view.previewPad": #region WorkbenchForm.MainForm.DeHideAllPad(); WorkbenchForm.MainForm.MainPreviewPad.Show(); break; #endregion case "MainMenu.view.fullScreenShow": #region if (!WorkbenchForm.MainForm.IsHideAllPad) { WorkbenchForm.MainForm.HideAllPad(); } else { WorkbenchForm.MainForm.DeHideAllPad(); } break; #endregion case "MainMenu.site.Manager": #region { Service.Workbench.OpenWorkDocument(WorkDocumentType.Manager, Service.Sdsite.CurrentDocument.RootChannel.Id); break; } #endregion case "MainMenu.site.tagMangager": #region { //SiteTagManagerForm form = new SiteTagManagerForm(); //form.ShowDialog(); break; } #endregion case "MainMenu.site.siteProperty": #region { Service.Workbench.OpenWorkDocument(WorkDocumentType.SiteProperty, Service.Sdsite.CurrentDocument.SdsiteName); break; } #endregion case "MainMenu.page.addPage": #region { //MyTreeView myTree = WorkbenchForm.MainForm.MainTreePad.TreeViewExPad.MyTree; //NewPageFormNoChan newPage = new NewPageFormNoChan(PageType.None); //newPage.Show(); NewPageForm form = new NewPageForm(null, PageType.None); form.ShowDialog(); break; } #endregion case "MainMenu.page.contentProperty": #region { string pageId = ((MdiHtmlDesignForm)WorkbenchForm.MainForm.ActiveMdiChild).PageId; PagePropertyForm pageTextPropertyForm = new PagePropertyForm(pageId); pageTextPropertyForm.Show(); break; } #endregion case "MainMenu.tmplt.addTmplt": #region { break; } #endregion case "MainMenu.report.ADStat": #region #endregion case "MainMenu.window.resetWindowLayout": #region { WorkbenchForm.MainForm.ResetAllPad(); break; } #endregion case "MainMenu.window.closeAllWindow": #region { Service.Workbench.CloseAllForm(); break; } #endregion case "MainMenu.user.logout": #region { Service.User.Logout(); break; } #endregion case "MainMenu.help.help": #region Process.Start(Path.Combine(PathService.CHS_Folder, "SimplusD!Help.chm")); break; #endregion case "MainMenu.help.checkUpdate": #region Service.Remote.CheckUpdate(true); break; #endregion case "MainMenu.help.aboutJeelu": #region //AboutJeelu aboutJL = new AboutJeelu(); //aboutJL.ShowDialog(); break; #endregion case "MainMenu.help.aboutSimplusD": #region SimplusDAboutForm aboutSD = new SimplusDAboutForm(); aboutSD.ShowDialog(); break; #endregion default: Service.Exception.ShowDefaultException(new Exception("未知的KeyId:" + item.KeyId)); break; } }