static public Shape StarControlFactory(double scale) { Random _random = new Random(); int selection = _random.Next(3); switch (selection) { case 0: Rectangle rectangleStar = new Rectangle(); rectangleStar.Width = 2 * scale; rectangleStar.Height = 2 * scale; rectangleStar.Fill = ColorFactory(); return(rectangleStar); case 1: Ellipse ellipseStar = new Ellipse(); ellipseStar.Width = 2 * scale; ellipseStar.Height = 2 * scale; ellipseStar.Fill = ColorFactory(); return(ellipseStar); case 2: BigStar bigStar = new BigStar(); bigStar.Width = 10 * scale; bigStar.Height = 10 * scale; bigStar.SetFill(ColorFactory()); return(bigStar.polygon); default: return(new Rectangle()); } }
public static Shape StarControlFactory(double scale) { Random _random = new Random(); int selection = _random.Next(3); switch (selection) { case 0: Rectangle rectangleStar = new Rectangle(); rectangleStar.Width = 2 * scale; rectangleStar.Height = 2 * scale; rectangleStar.Fill = ColorFactory(); return rectangleStar; case 1: Ellipse ellipseStar = new Ellipse(); ellipseStar.Width = 2 * scale; ellipseStar.Height = 2 * scale; ellipseStar.Fill = ColorFactory(); return ellipseStar; case 2: BigStar bigStar = new BigStar(); bigStar.Width = 10 * scale; bigStar.Height = 10 * scale; bigStar.SetFill(ColorFactory()); return bigStar.polygon; default: return new Rectangle(); } }