示例#1
0
        public void Show(Control view, ViewShowType showType)
        {
            var form = view as Form;

            if (form != null)
            {
                if (showType == ViewShowType.Dialog)
                {
                    form.ShowDialog();
                }
                else if (showType == ViewShowType.Mdi)
                {
                    _tabbedView.Manager.BeginUpdate();
                    form.MdiParent = _tabbedView.Manager.MdiParent;
                    form.Show();
                    _tabbedView.Manager.EndUpdate();
                }
                else
                {
                    form.Show();
                }
            }
            else
            {
                _tabbedView.AddDocument(view);
            }
        }
示例#2
0
        public bool ActivateView(string viewName, ViewShowType viewShowType)
        {
            bool result = false;

            if (_documents.ContainsKey(viewName))
            {
                if (viewShowType == ViewShowType.Mdi)
                {
                    App.Instance.MainWorkspace.TabbedView.ActivateDocument(_documents[viewName]);
                }
                else if (_documents[viewName] is Form)
                {
                    ((Form)_documents[viewName]).Activate();
                }
                result = true;
            }
            return(result);
        }
示例#3
0
        private IActionResult ShowView(ActionParameters parameters, string viewName, string pathName)
        {
            ViewShowType viewType = parameters.ViewShowType;

            if (App.Instance.ViewManager.ActivateView(viewName, viewType))
            {
                return(null);
            }
            var workspace = new RibbonFormWorkspace(parameters);

            workspace.ObjectName = ObjectName;
            workspace.Name       = viewName;
            var path = "/" + ObjectName + "/" + pathName;

            workspace.BasePath = path;

            workspace.LoadViews(parameters);
            if (workspace.ActiveView == null && !(workspace.ActionResult  is IPartialViewResult))
            {
                return(workspace.ActionResult);
            }
            if (viewType == ViewShowType.Dialog)
            {
                return(new ModalViewResult(workspace));
            }
            else if (viewType == ViewShowType.Show)
            {
                workspace.Location = new System.Drawing.Point(100, 100);
                ((RibbonFormWorkspace)workspace).SetBounds(((RibbonFormWorkspace)workspace).Bounds.X,
                                                           ((RibbonFormWorkspace)workspace).Bounds.Y, 900, 700);
                workspace.RestoreLayout();
                return(new DetailViewResult(workspace));
            }
            else
            {
                workspace.RestoreLayout();
            }
            return(new MdiViewResult(workspace, null));
        }
示例#4
0
 public ActionParameters(string objectName, Guid objectId, ViewShowType viewShowType)
 {
     _objectName   = objectName;
     _objectId     = objectId;
     _viewShowType = viewShowType;
 }