Example #1
0
        /// <summary>
        ///   This method refreshes ALL the action menus of the current menu on a specific form
        /// </summary>
        /// <param name = "form"></param>
        public void refreshInternalEventMenus(MgFormBase form)
        {
            TaskBase   task         = form.getTask();
            MgFormBase mdiChildForm = null;

            // refresh the action according to the pull down menu
            ICollection actions           = _internalEventsOnMenus.Keys;
            IEnumerator actionsEnumerator = actions.GetEnumerator();

            if (form.isSubForm())
            {
                MgControlBase subformCtrl = form.getSubFormCtrl();
                form = subformCtrl.getTopMostForm();
            }

            if (form.IsMDIChild)
            {
                mdiChildForm = form;
                form         = form.getTopMostFrameForm();
            }

            while (actionsEnumerator.MoveNext())
            {
                int  act    = ((Int32)actionsEnumerator.Current);
                bool enable = task.ActionManager.isEnabled(act);
                //The action enable\disable is save on the task but the menu of the subform is on the top most form
                enableInternalEvent(form, act, enable, mdiChildForm);
            }

            // refresh the action according to the tool bar
            actions           = _internalEventsOnToolBar.Keys;
            actionsEnumerator = actions.GetEnumerator();
            while (actionsEnumerator.MoveNext())
            {
                int  act    = ((Int32)actionsEnumerator.Current);
                bool enable = task.ActionManager.isEnabled(act);
                //The action enable\disable is save on the task but the menu of the subform is on the top most form

                enableInternalEvent(form, act, enable, mdiChildForm);
            }
        }