Пример #1
0
        private static void BuildUI(IUIFactory factory)         //... type of platform
        {
            /*
             *                  Call your method for platform here
             */
            IGrid grid = factory.CreateGrid();

            IButton button1 = factory.CreateButton();

            button1.Content = "BigPurpleButton";
            IButton button2 = factory.CreateButton();

            button2.Content = "SmallButton";
            IButton button3 = factory.CreateButton();

            button3.Content = "Baton";

            grid.AddButton(button1);
            grid.AddButton(button2);
            grid.AddButton(button3);


            ITextBox textBox1 = factory.CreateTextBox();

            textBox1.Content = "";
            ITextBox textBox2 = factory.CreateTextBox();

            textBox2.Content = "EmptyTextBox";
            ITextBox textBox3 = factory.CreateTextBox();

            textBox3.Content = "xoBtxeT";

            grid.AddTextBox(textBox1);
            grid.AddTextBox(textBox2);
            grid.AddTextBox(textBox3);

            var buttons = grid.GetButtons();

            foreach (var b in buttons)
            {
                b.ButtonPressed();
                b.DrawContent();
            }

            var textBoxes = grid.GetTextBoxes();

            foreach (var t in textBoxes)
            {
                t.DrawContent();
            }
        }