public void HidePanel(IdePanel panel) { Control parent = panel; while (parent != null) { if (parent is IdeGroupedPanel groupedPanel) { RemovePanelFromGroupedPanel(panel, groupedPanel); OnPanelStatusChanged(panel, false); return; } parent = parent.Parent; } var panelForm = panel.FindForm(); if (panelForm != null && !(panelForm is MainForm)) { _memorizedPanelPositions.Remove(panel); panelForm.Visible = false; OnPanelStatusChanged(panel, false); return; } RemovePanelFromSplitContainer(panel); OnPanelStatusChanged(panel, false); }
private void ShowPanel(IdePanel panel, IdePanel locationReference) { var panelForm = panel.FindForm(); if (panelForm != null && !(panelForm is MainForm)) { panelForm.Visible = true; OnPanelStatusChanged(panel, true); return; } if (!_memorizedPanelPositions.ContainsKey(locationReference)) { // Panel was never visible in the first place, show as new form CreateFloatPanel(panel); OnPanelStatusChanged(panel, true); return; } var position = _memorizedPanelPositions[locationReference]; _form.SuspendLayout(); if (position.Sibling != null) { var siblingForm = position.Sibling.FindForm(); if (siblingForm != null && siblingForm.Visible) AddPanelToGroupedPanel(position.Sibling, panel, position.Index); else { // Panel that was sibling when panel was hidden is no longer visible, so use its old position as reference ShowPanel(panel, position.Sibling); return; } } else AddPanelToSplitContainer(position.SplitContainer, panel, Math.Min(position.Index, position.SplitContainer.Panels.Count)); _form.ResumeLayout(); OnPanelStatusChanged(panel, true); }