private void Button_Click(object sender, RoutedEventArgs e) { Button btn = e.Source as Button; int id = Convert.ToInt32(btn.Tag); if (rlIndex != null && rlIndex.IsVisible) { rlIndex.Show(); rlIndex.Activate(); rlIndex.WindowState = System.Windows.WindowState.Normal; rlIndex.RackId = id; rlIndex.InitData(); } else { rlIndex = new RackLayerIndex(); rlIndex.RackId = id; rlIndex.Show(); } }