public void AddControl(TestStudioControlType type, string label, DockStyle dockStyle, string compositeId) { currentCompositeControl = GetControl(compositeId) as TestStudioCompositeControl; if (currentCompositeControl == null) return; AddControl(type, label, dockStyle); currentCompositeControl = null; }
public ITestStudioControl GetControl(TestStudioControlType type) { Type controlType = null; switch(type) { case TestStudioControlType.Button: controlType = typeof(TestStudioButton); break; case TestStudioControlType.ComboBox: controlType = typeof(TestStudioComboBox); break; case TestStudioControlType.DataGrid: controlType = typeof(TestStudioDataGrid); break; case TestStudioControlType.DockPanel: controlType = typeof(TestStudioDockPanel); break; case TestStudioControlType.EntryField: controlType = typeof(TestStudioTextBox); break; case TestStudioControlType.ListBox: controlType = typeof(TestStudioListBox); break; case TestStudioControlType.PropertyGrid: controlType = typeof(TestStudioPropertyGrid); break; case TestStudioControlType.TextBox: controlType = typeof(TestStudioTextBox); break; case TestStudioControlType.WsdlControl: controlType = typeof(WsdlControl); break; case TestStudioControlType.RequestControl: controlType = typeof(RequestControl); break; default: throw new NotImplementedException(); } var control = CreateControl(controlType); if (type == TestStudioControlType.TextBox) { ((TestStudioTextBox)control).Multiline = true; ((TestStudioTextBox)control).ScrollBars = System.Windows.Forms.ScrollBars.Both; } if (type == TestStudioControlType.WsdlControl) ((WsdlControl)control).Dock = System.Windows.Forms.DockStyle.Fill; if (type == TestStudioControlType.RequestControl) ((RequestControl)control).Dock = System.Windows.Forms.DockStyle.Fill; return control; }
public void AddControl(TestStudioControlType type, string label, DockStyle dockStyle, TestStudioTab tabId = TestStudioTab.None) { var control = (type==TestStudioControlType.Composite)? factory.GetCompositeControl(wrapChildren) : factory.GetControl(type); if (tabId == TestStudioTab.None) { if (currentCompositeControl != null) AddChildToComposite(control, label, dockStyle); else AddChildToForm(control, label, ConvertToDockState(dockStyle)); } else { AddChildToTab(tabId, control, label, ConvertToDockState(dockStyle)); } control.AddEventHandler("HandleDestroyed", new EventHandler(TestStudioFormBuilder_HandleDestroyed)); control.Label = label; // TODO: How do I keep this unique?? try { controls.Add(label, control); } catch { } lastControlAdded = control; }