private void WorkspaceTabs_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dynamoViewModel != null)
{
int workspace_index = dynamoViewModel.CurrentWorkspaceIndex;
//this condition is added for shutdown when we are clearing
//the workspace collection
if (workspace_index == -1) return;
var workspace_vm = dynamoViewModel.Workspaces[workspace_index];
workspace_vm.Model.OnCurrentOffsetChanged(this, new PointEventArgs(new Point2D(workspace_vm.Model.X, workspace_vm.Model.Y)));
workspace_vm.Model.OnZoomChanged(this, new ZoomEventArgs(workspace_vm.Zoom));
ToggleWorkspaceTabVisibility(WorkspaceTabs.SelectedIndex);
}
}