private void TabbedGroupPageChangedEventHandler(TabbedGroups tg, Crownwood.DotNetMagic.Controls.TabPage tp)
{
// de-activate the previous workspace before activating the new one
var lastActive = _workspaceActivationOrder.LastElement;
if (lastActive != null)
{
lastActive.SetActiveStatus(false);
}
// important to check tp != null to account for the case where the last workspace closes
var nowActive = (tp != null) ? (WorkspaceView)tp.Tag : null;
if (nowActive != null)
{
nowActive.SetVisibleStatus(true); // the very first time the page is selected, need to change its visible status
nowActive.SetActiveStatus(true);
_workspaceActivationOrder.Add(nowActive);
}
}