private void Remove_Click(object sender, RoutedEventArgs e) { if (TargetPanel.Children.Count > 0) { TargetPanel.RemoveChild(TargetPanel.Children[_random.Next(TargetPanel.Children.Count - 1)]); } }
private void Remove5_Click(object sender, RoutedEventArgs e) { int remove = Math.Min(TargetPanel.Children.Count, 5); if (remove > 0) { int index = _random.Next(TargetPanel.Children.Count - remove); for (int i = 0; i < remove; i++) { TargetPanel.RemoveChild(TargetPanel.Children[index + i]); } } }