コード例 #1
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag != null && e.Node.Tag is IDatabaseObject)
            {
                DatabaseObject baseObject = e.Node.Tag as DatabaseObject;

                var oldTab = tabControlDetail.TabPages[baseObject.Name];
                if (oldTab != null)
                {
                    tabControlDetail.SelectedTab = oldTab;
                    oldTab.Focus();
                }
                else
                {
                    if (baseObject.ObjectType == Enums.ObjectTypeEnum.TABLE)
                    {
                        var table = ((Table)e.Node.Tag);

                        TableInformation tableinfo = new TableInformation();
                        tableinfo.Dock          = DockStyle.Fill;
                        tableinfo.SelectedTable = table;
                        var tab = new Crownwood.DotNetMagic.Controls.TabPage();
                        tab.Title = table.Name;
                        tab.Controls.Add(tableinfo);

                        tabControlDetail.TabPages.Add(tab);
                        tabControlDetail.SelectedTab = tab;

                        tableinfo.Build();
                    }
                    else if (baseObject.ObjectType != Enums.ObjectTypeEnum.INDEX &&
                             baseObject.ObjectType != Enums.ObjectTypeEnum.Key &&
                             baseObject.ObjectType != Enums.ObjectTypeEnum.Database &&
                             baseObject.ObjectType != Enums.ObjectTypeEnum.Column &&
                             baseObject.ObjectType != Enums.ObjectTypeEnum.Schema
                             )
                    {
                        var dbObject = ((DatabaseObject)e.Node.Tag);

                        ScriptControl scriptControl = new ScriptControl();
                        scriptControl.DbObject = dbObject;
                        scriptControl.Dock     = DockStyle.Fill;
                        var tab = new Crownwood.DotNetMagic.Controls.TabPage();

                        tab.Title = dbObject.Name;
                        tab.Controls.Add(scriptControl);

                        tabControlDetail.TabPages.Add(tab);
                        tabControlDetail.SelectedTab = tab;
                        scriptControl.Build();
                    }
                }
            }
        }
コード例 #2
0
        private void tabloBilgileriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dbItem = treeView1.SelectedNode.Tag as Table;

            if (dbItem != null)
            {
                TableInformation tableinfo = new TableInformation();
                tableinfo.Dock          = DockStyle.Fill;
                tableinfo.SelectedTable = dbItem;
                var tab = new Crownwood.DotNetMagic.Controls.TabPage();
                tab.Controls.Add(tableinfo);
                tab.Title = "Tablo Bilgileri";

                tabControlDetail.TabPages.Add(tab);

                tableinfo.Build();
            }
        }