ComponentFactory.Krypton.Workspace.KryptonWorkspaceSequence.CompactRemoveEmptyCells C# (CSharp) Method

CompactRemoveEmptyCells() private method

private CompactRemoveEmptyCells ( CompactFlags flags ) : void
flags CompactFlags
return void
        private void CompactRemoveEmptyCells(CompactFlags flags)
        {
            if ((flags & CompactFlags.RemoveEmptyCells) == CompactFlags.RemoveEmptyCells)
            {
                // Search for child cell items
                for (int i = Children.Count - 1; i >= 0; i--)
                {
                    // If a cell and that cell does not have any pages
                    KryptonWorkspaceCell cell = Children[i] as KryptonWorkspaceCell;
                    if ((cell != null) && (cell.Pages.Count == 0))
                    {
                        Children.RemoveAt(i);

                        // If the cell is not inside a controls collection then we need to dispose of it here
                        // because the layout code will never try and dispose on remove from controls collection
                        // as it is not inside the controls collection
                        if ((cell.Parent == null) && (cell.DisposeOnRemove))
                            cell.Dispose();
                    }
                }
            }
        }