ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupColorButton.DecideOnVisible C# (CSharp) Method

DecideOnVisible() private method

private DecideOnVisible ( KryptonContextMenuItemBase visible, KryptonContextMenuItemBase target ) : void
visible ComponentFactory.Krypton.Toolkit.KryptonContextMenuItemBase
target ComponentFactory.Krypton.Toolkit.KryptonContextMenuItemBase
return void
        private void DecideOnVisible(KryptonContextMenuItemBase visible, KryptonContextMenuItemBase target)
        {
            bool previous = false;

            // Only search if the target itself is visible
            if (target.Visible)
            {
                // Check all items before the target
                foreach (KryptonContextMenuItemBase item in _kryptonContextMenu.Items)
                {
                    // Finish when we reach the target
                    if (item == target)
                        break;

                    // We do not consider existing separators
                    if (!((item is KryptonContextMenuSeparator) ||
                          (item is KryptonContextMenuHeading)))
                    {
                        // If the previous item is visible, then make the parameter visible
                        if (item.Visible)
                        {
                            previous = true;
                            break;
                        }
                    }
                }
            }

            visible.Visible = previous;
        }