Show/Hide Layer/Properties/etc Panels in C#?

Hi.

Please excuse me if this is a bit basic, but I have looked for a bit now on the forum, as well as the CS Samples and I cannot seem to find a way to easily turn off the Layers Panel (or any other Panel, for that matter).

I am running a process which is very intensive regarding the creation/deletion of layer objects (I am routinely creating/deleting/updating as much as 2,000 Layers!). I noticed that if the user leaves the interface with the Layers Panel visible/active, then the process takes much, much longer. Hence, I would like to simply turn it off (or freeze it) whilst I am doing the layer creation/modification and, afterwards, I would like to turn it back on/unfreeze it. The closest I have gotten is this:

        System.Guid[] panelIds = Rhino.UI.Panels.GetOpenPanelIds();
        foreach (Guid pnlid in panelIds)
        {
            var pnl = Rhino.UI.Panels.GetPanel(pnlid);
        }

However, pnl remains as null, no matter what I do.

Any guidance is always appreciated!

Thanks!

Found the answer. Based on an older post from Dale:

using Rhino;

To hide:

        Guid layer_id = Rhino.UI.PanelIds.Layers;
        Rhino.UI.Panels.ClosePanel(layer_id);

To show:

Rhino.UI.Panels.OpenPanel(layer_id);