示例#1
0
文件: Manager.cs 项目: rinavin/RCJS
        /// <summary> Open the form. </summary>
        /// <param name="mgForm">form to be opened.</param>
        public static void OpenForm(MgFormBase mgForm)
        {
            mgForm.startupPosition();

            // non interactive can choose not to open the window.
            if (!mgForm.Opened && (mgForm.getTask().IsInteractive || mgForm.getTask().isOpenWin()))
            {
                if (!mgForm.isSubForm())
                {
                    // if the form is to be opened as a modal, then increment the modal count on its frame window.
                    if (mgForm.isDialog())
                    {
                        MgFormBase topMostFrameForm = mgForm.getTopMostFrameForm();
                        if (topMostFrameForm != null)
                        {
                            topMostFrameForm.UpdateModalFormsCount(mgForm, true);
                        }
                    }

                    if (mgForm.ParentForm != null)
                    {
                        mgForm.ParentForm.ApplyChildWindowPlacement(mgForm);
                    }

                    Commands.addAsync(CommandType.INITIAL_FORM_LAYOUT, mgForm, mgForm.isDialog(), mgForm.Name);
                    ApplyformUserState(mgForm);
                }
                else
                {
                    //layout for subform already was resumend
                    if (!mgForm.getTask().ShouldResumeSubformLayout)
                    {
                        ApplyformUserState(mgForm);
                    }
                }


                if (!mgForm.isSubForm())
                {
                    Commands.addAsync(CommandType.SHOW_FORM, mgForm, mgForm.isDialog(), false, mgForm.Name);
                }

                // expand does not executed until form is opened, when form is opened tree sends expand events on all expanded nodes.
                // we need to perform this before we perform ensureSelection on the selected node - to make sure that selected node is visible
                // QCR #764980
                // for RTE the mgTree might not exist yet, so skip it.
                if (mgForm.hasTree() && mgForm.getMgTree() != null)
                {
                    mgForm.getMgTree().updateExpandStates(1);
                    mgForm.SelectRow(true);
                }

                mgForm.Opened = true;

                Commands.beginInvoke();
            }
        }