private void OnTabChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { grid.ClearGrid(); Hide3DGrid(); toolbox.Clear(); if (StateChanger.SelectedIndex == 0) // Factory-Tab { csu.isSimulation = false; toolbox.Init(); OnFactorySelected(sender, e); BorderArea.Visibility = Visibility.Visible; } else // Simulation-Tab { csu.isSimulation = true; OnSimulationFactorySelected(sender, e); BorderArea.Visibility = Visibility.Hidden; } }