Пример #1
0
        /// <summary> </summary>
        /// <param name = "guiMgForm"></param>
        /// <param name = "prompt"></param>
        private void onMenuPrompt(GuiMgForm guiMgForm, GuiMenuEntry guiMenuEntry)
        {
            MgFormBase mgForm = null;
            TaskBase   task   = null;

            if (guiMgForm is MgFormBase)
            {
                mgForm = (MgFormBase)guiMgForm;
            }

            if (mgForm != null)
            {
                task = mgForm.getTask();
            }

            if (task != null)
            {
                if (guiMenuEntry == null)
                {
                    if (!task.isAborting())
                    {
                        Manager.CleanMessagePane(task);
                    }
                }
                else
                {
                    if (guiMenuEntry is MenuEntry)
                    {
                        MenuEntry menuEntry = (MenuEntry)guiMenuEntry;

                        String prompt = menuEntry.getPrompt();
                        if (prompt == null)
                        {
                            prompt = "";
                        }

                        Manager.WriteToMessagePane(task, StrUtil.makePrintable(prompt), false);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///   check/uncheck menu entry identified by entryName.
        /// </summary>
        /// <param name = "task"></param>
        /// <param name = "entryName">menuentry name </param>
        /// <param name = "check">check/uncheck value</param>
        public bool MenuCheckByName(TaskBase task, String entryName, bool check)
        {
            MgMenu pulldownMenu = GetPulldownMenu(task);

            // Get matching menus from all ctls
            ArrayList menuEntryList = GetMatchingMenuValues(task.ContextID, entryName, pulldownMenu);

            if (menuEntryList != null)
            {
                IEnumerator iMatchingEnt = menuEntryList.GetEnumerator();
                while (iMatchingEnt.MoveNext())
                {
                    var menuValue = (MenuValue)iMatchingEnt.Current;
                    var mnuEnt    = menuValue.InnerMenuEntry;

                    bool refresh;
                    if (menuValue.IsPulldown)
                    {
                        refresh = true;
                    }
                    else
                    {
                        refresh = false;
                    }

                    mnuEnt.setChecked(check, refresh);
                }
            }

            if (pulldownMenu != null && IsTopLevelMenu(pulldownMenu, entryName))
            {
                Manager.WriteToMessagePane(task, "Check/UnCheck of top level menu item is not allowed", false);
            }

            return(true);
        }