/// <summary> /// Checks if this panel contains give panel /// </summary> /// <param name="panel">panel to check</param> /// <returns>true if this panel contains given pane</returns> public bool ContainsPanel(AutoHidePanel panel) { for (int index = ButtonsCount - 1; index >= 0; index--) { UnitButton button = GetButtonAt(index); FormsTabbedView view = HierarchyUtility.GetTabbedView((Form)button.Page); if (view.Parent == panel) { return(true); } } return(false); }
/// <summary> /// Removes the panel if is contained here /// </summary> /// <param name="panel">panel to remove</param> /// <returns>true if is removed the panel</returns> public bool Remove(AutoHidePanel panel) { bool removed = false; for (int index = ButtonsCount - 1; index >= 0; index--) { UnitButton button = GetButtonAt(index); FormsTabbedView view = HierarchyUtility.GetTabbedView((Form)button.Page); if (view.Parent == panel) { RemoveButton(button); removed = true; } } panel.View.FormAdded -= OnFormAddedToPanel; panel.View.FormRemoved -= OnFormRemovedFromPanel; panel.View.FormSelected -= OnFormSelectedIntoView; return(removed); }