Beispiel #1
0
        /// <summary>
        /// 通过窗体得到ISearch和IMarkPosition
        /// </summary>
        /// <param name="form"></param>
        /// <param name="kv">Key是ISearch,Value是IMarkPosition</param>
        /// <returns>是否可以转换</returns>
        private bool GetFormDocument(BaseViewForm form, out KeyValuePair <ISearch, IMarkPosition> kv)
        {
            if (form == null)
            {
                kv = new KeyValuePair <ISearch, IMarkPosition>();
                return(false);
            }
            ISearch       _search;
            IMarkPosition _markPosition;

            switch (form.WorkDocumentType)
            {
                #region
            //case WorkDocumentType.TmpltDesigner:
            //    MdiTmpltDesignForm tmpltForm = (MdiTmpltDesignForm)form;
            //    _markPosition = tmpltForm;
            //    _search = Service.Sdsite.CurrentDocument.GetTmpltDocumentById(tmpltForm.TmpltID);
            //    break;
            case WorkDocumentType.HtmlDesigner:
                MdiHtmlDesignForm htmlForm = (MdiHtmlDesignForm)form;
                _markPosition = htmlForm;
                _search       = Service.Sdsite.CurrentDocument.GetPageDocumentById(htmlForm.PageId);
                break;

            //case WorkDocumentType.SnipDesigner:
            //    MdiSnipDesignerForm snipForm = (MdiSnipDesignerForm)form;
            //    _markPosition = snipForm;
            //    _search = Service.Sdsite.CurrentDocument.GetTmpltDocumentById(snipForm.TmpltID);
            //    break;
            case WorkDocumentType.Edit:
                MdiBaseEditViewForm editForm = (MdiBaseEditViewForm)form;
                _markPosition = editForm;
                _search       = Service.Sdsite.CurrentDocument.GetPageDocumentById(editForm.PageId);
                break;

            //case WorkDocumentType.HomePage:
            //    MdiHomePageDesignForm homeForm = (MdiHomePageDesignForm)form;
            //    _markPosition = homeForm;
            //    _search = Service.Sdsite.CurrentDocument.GetTmpltDocumentById(homeForm.TmpltID);
            //    break;
            case WorkDocumentType.None:
            case WorkDocumentType.WebBrowser:
            case WorkDocumentType.Manager:
            case WorkDocumentType.StartupPage:
            case WorkDocumentType.SiteProperty:
            default:
                kv = new KeyValuePair <ISearch, IMarkPosition>();
                return(false);

                #endregion
            }
            kv = new KeyValuePair <ISearch, IMarkPosition>(_search, _markPosition);
            return(true);
        }
Beispiel #2
0
        Form OpenWorkDocument(WorkDocumentType type, string id, string ownerId)
        {
            Debug.Assert(!string.IsNullOrEmpty(id));

            Form returnForm = null;

            switch (type)
            {
            case WorkDocumentType.TmpltDesigner:
            {
                MdiTmpltDesignForm form = new MdiTmpltDesignForm(id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.HomePage:
            {
                MdiHomePageDesignForm form = new MdiHomePageDesignForm(id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.HtmlDesigner:
            {
                MdiHtmlDesignForm form = new MdiHtmlDesignForm(id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.SnipDesigner:
            {
                MdiSnipDesignerForm form = new MdiSnipDesignerForm(ownerId, id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.WebBrowser:
            {
                returnForm = NavigationUrl(id);
                break;
            }

            //TODO:管理页面合一 Lisuye
            case WorkDocumentType.Manager:
            {
                MdiBaseListViewForm form = new MdiBaseListViewForm(id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(WorkbenchForm.MainForm.MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.Edit:
            {
                MdiBaseEditViewForm form = new MdiBaseEditViewForm(id);
                form.Owner = WorkbenchForm.MainForm;
                form.Show(WorkbenchForm.MainForm.MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.StartupPage:
            {
                MdiWelComePageForm form = new MdiWelComePageForm();
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            case WorkDocumentType.SiteProperty:
            {
                SitePropertyForm form = new SitePropertyForm(id);
                form.Show(MainDockPanel, DockState.Document);
                returnForm = form;
                break;
            }

            default:
                break;
            }
            return(returnForm);
        }