public void AddCompositeControlToForm(DockStyle dockStyle, TestStudioTab tabId = TestStudioTab.None)
        {
            // If we are not using a dockpanel then we need to set the
            // native Dock property.
            if (wrapChildren == false)
                (currentCompositeControl as Control).Dock = dockStyle;

            if (tabId == TestStudioTab.None)
            {
                AddChildToForm(currentCompositeControl, currentCompositeControl.Label, ConvertToDockState(dockStyle));

            }
            else
            {
                (currentCompositeControl as Control).Dock = DockStyle.Fill;
                AddChildToTab(tabId, currentCompositeControl, currentCompositeControl.Label, ConvertToDockState(dockStyle));
            }

            currentCompositeControl.AddEventHandler("HandleDestroyed", new EventHandler(TestStudioFormBuilder_HandleDestroyed));
            controls.Add(currentCompositeControl.Label, currentCompositeControl);

            currentCompositeControl = null;
        }
        private void AddChildToTab(TestStudioTab tabId, ITestStudioControl child, string label, DockState dockState)
        {
            var testStudioContent = WrapChild(child, dockState);
            testStudioContent.Label = label;

            TestStudioCompositeControl tab;
            if (tabs.TryGetValue(tabId, out tab))
                tab.AddChild(testStudioContent);
            else
            {
                MessageBox.Show(String.Format("{0} tab does not exist.", tabId.ToString()));
                return;
            }
        }
 public TestStudioCompositeControl GetTab(TestStudioTab tabId)
 {
     TestStudioCompositeControl tab = null;
     tabs.TryGetValue(tabId, out tab);
     return tab;
 }
 public void CreateTab(TestStudioTab tabId)
 {
     var tab = factory.GetCompositeControl(true);
     tab.Label = tabId.ToString();
     tabs.Add(tabId, tab);
     AddChildToForm(tab, tabId.ToString(), DockState.Document);
 }
 public void CreateCompositeControl(string controlId, bool useDockPanel, DockStyle dockStyle, TestStudioTab tabId = TestStudioTab.None)
 {
     wrapChildren = useDockPanel;
     AddControl(TestStudioControlType.Composite, controlId, dockStyle, tabId);
 }
        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;
        }