public static void ShowFactory(IToyFactory factory)
        {
            Bear bear = factory.GetBear();
            Cat  cat  = factory.GetCat();

            Console.WriteLine($"I've got {bear.ToyName} and {cat.ToyName}");
        }
Example #2
0
 private void ballBtn_Click(object sender, EventArgs e)
 {
     Factory = new BallFactory()
     {
         BallColor = ballColor.BackColor
     };
 }
Example #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     Factory = new BallFactory()
     {
         BallColor = button3.BackColor
     };
 }
Example #4
0
        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);
        }
Example #5
0
 private void presentBtn_Click(object sender, EventArgs e)
 {
     Factory = new PresentFactory()
     {
         Ribbon = presentRibbon.BackColor,
         Box    = presentBox.BackColor
     };
 }
Example #6
0
 private void button4_Click(object sender, EventArgs e)
 {
     Factory = new PresentFactory
     {
         Box    = button5.BackColor,
         Ribbon = button6.BackColor
     };
 }
Example #7
0
 private void carBtn_Click(object sender, EventArgs e)
 {
     Factory = new CarFactory();
 }
Example #8
0
 public Form1()
 {
     InitializeComponent();
     Factory = new BallFactory();
 }
Example #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     Factory = new CarFactory();
 }