Example #1
0
        protected virtual void Show(bool focus)
        {
            var prevOwner = MenuControl.GetTag <ButtonBase>("Owner");

            if (prevOwner != null && prevOwner is ButtonBase prevCheck)
            {
                prevCheck.Checked = false;
            }

            MenuControl.SetTag("Owner", this);

            BeforeShow?.Invoke();

            Checked     = true;
            IsPopupOpen = true;

            var location = ActualLocation;

            if (MenuControl is ContextMenuStrip)
            {
                showContextMenu(location);
            }
            else
            {
                setRegularMenuLocation(location);
                showRegularMenu();
            }

            if (focus)
            {
                focusFirstMenuItem();
            }
        }
        /// <summary>
        /// Displays the MenuPage, and selects its default element.
        /// </summary>
        public void Show()
        {
            BeforeShow?.Invoke();

            self.SetActive(true);
            cg.interactable = true;
            cg.alpha        = 1f;
            isShowing       = true;
            MenuChangerMod.displayedPages.Add(this);
            nav.SelectDefault();

            AfterShow?.Invoke();
        }