private void Button_Click(object sender, RoutedEventArgs e) { int n = materials.Children.Count; for (int i = 0; i < n; i++) { Card temp = materials.Children[0] as Card; materials.Children.RemoveAt(0); Canvas.SetTop(temp, (xyz_cv.ActualHeight - temp.ActualHeight) / 2.0); Canvas.SetLeft(temp, (xyz_cv.ActualWidth - temp.ActualWidth) / 2.0); xyz_cv.Children.Insert(0, temp); } Card top = xyz_cv.Children[xyz_cv.Children.Count - 1] as Card; if (top.sCardType.Equals("XYZ怪兽") && top.isDef) { CardOperate.sort_Canvas(xyz_cv); } else { CardOperate.sort_Canvas(xyz_cv); } this.Close(); this.Dispose(); }