private void createBtn_clicked(object sender, RoutedEventArgs e) { Elements.Clear(); AbstractFactory factory; if (rectRadioButton.IsChecked == true) { factory = new RectangleFactory(); } else { factory = new SquareFactory(); } for (int i = 0; i < countSlider.Value; ++i) { UIElement element; if (redRadioButton.IsChecked == true) { element = factory.CreateRed(); } else { element = factory.CreateBlue(); } Elements.Add(element); } Close(); }
public RectFactoryDecorator(RectangleFactory factory) { m_factory = factory; }