Ejemplo n.º 1
0
 private static void UpdateState(CheckBoxMenuItemCollection menuItems, CheckBoxMenuItemState state)
 {
     if (state.Vector.Count > 0)
     {
         UpdateState(menuItems, 0, state);
     }
 }
Ejemplo n.º 2
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);
            }
        }