예제 #1
0
        //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;
            }
        }