Exemplo n.º 1
0
        private TabPage CreateRquestTabPage(string tabName)
        {
            var tabPage           = new TabPage(tabName);
            var usrRequestControl = new UsrRequestControl(webRequest, Guid.NewGuid());

            usrRequestControl.SaveNode += SaveNodeToTree;
            usrRequestControl.Dock      = DockStyle.Fill;
            tabPage.Controls.Add(usrRequestControl);

            return(tabPage);
        }
Exemplo n.º 2
0
        private void TreeViewTestData_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Text == "Root")
            {
                return;
            }

            TabPage existingTabPage = null;

            foreach (TabPage tabPage in tabControl.TabPages)
            {
                if (tabPage.Tag == null || e.Node.Tag == null)
                {
                    continue;
                }

                if ((Guid)tabPage.Tag == (Guid)e.Node.Tag)
                {
                    existingTabPage = tabPage;
                    break;
                }
            }

            if (existingTabPage == null)
            {
                var usrRequestControl = new UsrRequestControl(webRequest, (Guid)e.Node.Tag);
                usrRequestControl.UpdateForm(e.Node.Text, (Guid)e.Node.Tag);
                usrRequestControl.SaveNode += SaveNodeToTree;
                usrRequestControl.Dock      = DockStyle.Fill;
                existingTabPage             = new TabPage(e.Node.Text);
                existingTabPage.Tag         = (Guid)e.Node.Tag;
                existingTabPage.Controls.Add(usrRequestControl);

                tabControl.TabPages.Insert(0, existingTabPage);
            }

            tabControl.SelectedTab = existingTabPage;
        }