示例#1
0
 /// <summary>
 ///   Refresh the pulldown menu actions.
 /// </summary>
 /// <param name = "frameForm"></param>
 public void RefreshPulldownMenuActions(MgFormBase frameForm)
 {
     MenuStyle[] stylesToRefresh = new[]
     {
         MenuStyle.MENU_STYLE_PULLDOWN,
         MenuStyle.MENU_STYLE_TOOLBAR
     };
     foreach (var style in stylesToRefresh)
     {
         // refresh the actions
         MgMenu mgMenu = frameForm.getMgMenu(style);
         if (mgMenu != null)
         {
             mgMenu.refreshMenuAction(frameForm, style);
         }
     }
 }
示例#2
0
        /// <summary>
        ///   refresh the actions of all menus belonging to the current task (according to the current task state)
        /// </summary>
        /// <param name = "currentTask"></param>
        public void refreshMenuActionForTask(TaskBase currentTask)
        {
            MgFormBase currentForm = currentTask.getForm();

            if (currentForm != null)
            {
                MgFormBase menusContainerForm; // the form containing the menus to be refreshed
                if (currentForm.isSubForm())
                {
                    menusContainerForm = currentForm.getSubFormCtrl().getTopMostForm();
                    if (menusContainerForm.IsMDIChild || menusContainerForm.IsFloatingToolOrModal)
                    {
                        menusContainerForm = menusContainerForm.getTopMostFrameForm();
                    }
                }
                else
                {
                    menusContainerForm = currentForm.getTopMostFrameForm();
                }

                if (menusContainerForm == null)
                {
                    menusContainerForm = currentForm.getTopMostFrameFormForMenuRefresh();
                }

                if (menusContainerForm != null)
                {
                    MenuStyle[] stylesToRefresh = new[]
                    {
                        MenuStyle.MENU_STYLE_PULLDOWN, MenuStyle.MENU_STYLE_CONTEXT,
                        MenuStyle.MENU_STYLE_TOOLBAR
                    };
                    foreach (var style in stylesToRefresh)
                    {
                        // refresh the actions
                        MgMenu mgMenu = menusContainerForm.getMgMenu(style);
                        if (mgMenu != null)
                        {
                            mgMenu.refreshMenuAction(currentTask.getForm(), style);
                        }
                    }
                }
            }
        }