I understand your question, you want to know how to display or hide the layer so you can integrate that in your switcher.
Our client side is based on OpenLayers library, the LayerSwitcher is a control from OpenLayers, we just did enhancement based on that. In fact in the first topic I listed Howard mentioned about that, you can show or hide that like this, please view that topic it contains more detail including links:
One is Map.setBaseLayer(layer) which is to switch between base overlays;
While another one is Layer.display(isVisible) which is to set a dynamic overlay’s visibility.