Ejemplo n.º 1
0
        /// <summary>
        /// Update the status of all items by calling their status callback and remove the separators in excess. This is called just before displaying the menu.
        /// </summary>
        public void PrepareForDisplay(EventBase e)
        {
            m_DropdownMenuEventInfo = e != null ? new DropdownMenuEventInfo(e) : null;

            if (menuItems.Count == 0)
            {
                return;
            }

            foreach (DropdownMenuItem item in menuItems)
            {
                DropdownMenuAction action = item as DropdownMenuAction;
                if (action != null)
                {
                    action.UpdateActionStatus(m_DropdownMenuEventInfo);
                }
            }

            if (menuItems[menuItems.Count - 1] is DropdownMenuSeparator)
            {
                menuItems.RemoveAt(menuItems.Count - 1);
            }
        }
Ejemplo n.º 2
0
        public void PrepareForDisplay(EventBase e)
        {
            this.m_DropdownMenuEventInfo = ((e != null) ? new DropdownMenuEventInfo(e) : null);
            bool flag = this.menuItems.Count == 0;

            if (!flag)
            {
                foreach (DropdownMenuItem current in this.menuItems)
                {
                    DropdownMenuAction dropdownMenuAction = current as DropdownMenuAction;
                    bool flag2 = dropdownMenuAction != null;
                    if (flag2)
                    {
                        dropdownMenuAction.UpdateActionStatus(this.m_DropdownMenuEventInfo);
                    }
                }
                bool flag3 = this.menuItems[this.menuItems.Count - 1] is DropdownMenuSeparator;
                if (flag3)
                {
                    this.menuItems.RemoveAt(this.menuItems.Count - 1);
                }
            }
        }