示例#1
0
 private static void UpdateState(CheckBoxMenuItemCollection menuItems, CheckBoxMenuItemState state)
 {
     if (state.Vector.Count > 0)
     {
         UpdateState(menuItems, 0, state);
     }
 }
示例#2
0
        private static void GetPanelItems(int column, CheckBoxPanel panel, CheckBoxMenuItemCollection menuItems, IList <IList <CheckBoxPanel> > columnPanels)
        {
            for (var index = 0; index < menuItems.Count; ++index)
            {
                // Add a panel item for each menu item.

                var menuItem = menuItems[index];
                var tag      = CreateTag(panel.Tag, index);
                panel.PanelItems.Add(new CheckBoxPanelItem(tag, menuItem));

                // If this menu item has children, then create a new panel for it in the next column.

                if (menuItem.ChildMenuItems.Count > 0)
                {
                    var childPanel = new CheckBoxPanel(menuItem.Text, tag);
                    GetPanels(columnPanels, column + 1).Add(childPanel);
                    GetPanelItems(column + 1, childPanel, menuItem.ChildMenuItems, columnPanels);
                }
            }
        }
示例#3
0
        private string GetMenuPanelId(string value, CheckBoxMenuItemCollection menuItems, string parentTag)
        {
            for (var index = 0; index < menuItems.Count; ++index)
            {
                var menuItem = menuItems[index];
                var tag      = CreateTag(parentTag, index);

                if (menuItem.Value == value)
                {
                    return(GetPanelClientId(tag));
                }

                // Iterate.

                var id = GetMenuPanelId(value, menuItems[index].ChildMenuItems, tag);
                if (!string.IsNullOrEmpty(id))
                {
                    return(id);
                }
            }

            return(null);
        }
示例#4
0
        private static void UpdateState(CheckBoxMenuItemCollection menuItems, int index, CheckBoxMenuItemState state)
        {
            var coordinate = state.Vector[index];

            if (coordinate >= menuItems.Count)
            {
                return;
            }

            var menuItem = menuItems[coordinate];

            if (index == state.Vector.Count - 1)
            {
                // Reached the end so set it.

                menuItem.Checked = state.Checked;
            }
            else
            {
                // Keep going.

                UpdateState(menuItem.ChildMenuItems, index + 1, state);
            }
        }