Пример #1
0
        public static void AddPanel(PanelBase panel)
        {
            if (panel == null)
            {
                return;
            }

            ClosePreviousPanel(panel);
            if (panel.IsStackable())
            {
                _panels.Add(panel);
            }

            if (!panel.IsOpen())
            {
                panel.OnPanelOpened();
            }
        }
Пример #2
0
        public static void RemovePanel(PanelBase panel)
        {
            if (_panels == null || panel == null)
            {
                return;
            }

            var v_panelIndex = _panels.FindIndex(p => p.GetInstanceID() == panel.GetInstanceID());

            if (v_panelIndex > 0 && !_panels[v_panelIndex - 1].IsOpen())
            {
                _panels[v_panelIndex - 1].OnPanelOpened();
            }

            if (panel.IsStackable())
            {
                _panels.Remove(panel);
            }

            if (panel.IsOpen())
            {
                panel.OnPanelClosed();
            }
        }