private static void BuildUI(Factory factory) //... type of platform { IGrid grid = factory.GetGrid(); IEnumerable <IButton> buttons; IEnumerable <ITextBox> textBoxes; grid.AddButton(factory.GetButton("BigPurpleButton")); grid.AddButton(factory.GetButton("SmallButton")); grid.AddButton(factory.GetButton("Baton")); grid.AddTextBox(factory.GetTextBox("")); grid.AddTextBox(factory.GetTextBox("EmptyTextBox")); grid.AddTextBox(factory.GetTextBox("xoBtxeT")); buttons = grid.GetButtons(); textBoxes = grid.GetTextBoxes(); foreach (IButton bt in buttons) { bt.ButtonPressed(); bt.DrawContent(); } if (textBoxes != null) { foreach (ITextBox tb in textBoxes) { tb.DrawContent(); } } }
private static void BuildUI(UIFactory factory) { IGrid grid = factory.createGrid(); // zrobilem konstruktor ktory przyjmuje content bo nie chce mi sie pisac /* * IButton but = factory.createButton(""); * but.Content = "dupa"; * grid.AddButton(but); */ grid.AddButton(factory.createButton("BigPurpleButton")); grid.AddButton(factory.createButton("SmallButton")); grid.AddButton(factory.createButton("Baton")); grid.AddTextBox(factory.createTextBox("")); grid.AddTextBox(factory.createTextBox("EmptyTextBox")); grid.AddTextBox(factory.createTextBox("xoBtxeT")); foreach (var i in grid.GetButtons()) { i.ButtonPressed(); i.DrawContent(); } foreach (var i in grid.GetTextBoxes()) { i.DrawContent(); } }
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(); } }
private static void BuildInterface(IGuiFactory factory) { IGrid grid = factory.GenerateGrid(); for (int i = 0; i < 3; i++) { IButton btn = factory.GenerateButton(); btn.Content = $"Button{i+1}"; grid.AddButton(btn); ITextBox txtBox = factory.GenerateTextBox(); txtBox.Content = $"TextBox{i + 1}"; grid.AddTextBox(txtBox); } grid.GetButtons().First().ButtonPressed(); foreach (var elem in grid.GetButtons()) { elem.ButtonPressed(); elem.DrawContent(); } foreach (var elem in grid.GetTextBoxes()) { elem.DrawContent(); } }