public static void ShowFactory(IToyFactory factory) { Bear bear = factory.GetBear(); Cat cat = factory.GetCat(); Console.WriteLine($"I've got {bear.ToyName} and {cat.ToyName}"); }
private void ballBtn_Click(object sender, EventArgs e) { Factory = new BallFactory() { BallColor = ballColor.BackColor }; }
private void button2_Click(object sender, EventArgs e) { Factory = new BallFactory() { BallColor = button3.BackColor }; }
private static void RunFactory(IToyFactory toyFactory) { Bear bear = toyFactory.GetBear(); Cat cat = toyFactory.GetCat(); Console.WriteLine("I've got {0} and {1}", bear.Name, cat.Name); }
private void presentBtn_Click(object sender, EventArgs e) { Factory = new PresentFactory() { Ribbon = presentRibbon.BackColor, Box = presentBox.BackColor }; }
private void button4_Click(object sender, EventArgs e) { Factory = new PresentFactory { Box = button5.BackColor, Ribbon = button6.BackColor }; }
private void carBtn_Click(object sender, EventArgs e) { Factory = new CarFactory(); }
public Form1() { InitializeComponent(); Factory = new BallFactory(); }
private void button1_Click(object sender, EventArgs e) { Factory = new CarFactory(); }