コード例 #1
0
        private void tvDatabase_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeView tv = sender as TreeView;
            TreeNode tn = tv.GetNodeAt(e.X, e.Y);

            if (tn != null && tn.Level == 1 && tn.Nodes.Count == 0)
            {
                LoadDbSchema(tn);
                tn.Expand();
            }
            if (tn != null && tn.Parent != null && tn.Level == 3)
            {
                if (tn.Parent.Text == "表")
                {
                    if (this.DockPanel.ActiveDocument is CodeBuilder)
                    {
                        SOTable t = tvDatabase.SelectedNode.Tag as SOTable;
                        if (t == null)
                        {
                            return;
                        }

                        CodeBuilder builder = this.DockPanel.ActiveDocument as CodeBuilder;
                        builder.Table      = t;
                        builder.ColumnList = dbSchema.GetTableColumnList(t);
                        builder.LoadColumnList();
                    }
                }
            }
        }
コード例 #2
0
        //代码生成器
        private void menuItemBuildCodeForTable_Click(object sender, EventArgs e)
        {
            TreeNode    tn      = tvDatabase.SelectedNode;
            SOTable     table   = tn.Tag as SOTable;
            CodeBuilder builder = null;

            //保证代码生成器使用一个实例
            if (this.DockPanel.ActiveDocument != null && this.DockPanel.ActiveDocument is CodeBuilder)
            {
                builder            = this.DockPanel.ActiveDocument as CodeBuilder;
                builder.Table      = table;
                builder.ColumnList = dbSchema.GetTableColumnList(table);
                builder.LoadColumnList();
            }
            else
            {
                builder            = new CodeBuilder();
                builder.Table      = table;
                builder.ColumnList = dbSchema.GetTableColumnList(table);
                builder.LoadColumnList();//???:初始化列表CheckBox状态时,数据需要Load两次才能将CheckBox列全部初始化为选中状态
                builder.Show(this.DockPanel);
            }
        }
コード例 #3
0
        //使用自定义模板批量生成代码
        //private void menuItemBatchBuildCustomCode_Click(object sender, EventArgs e)
        //{
        //    SODatabase db = null;
        //    TreeNode node = tv.SelectedNode;

        //    if (node.Tag is PDModel)
        //    {
        //        PDModel m = node.Tag as PDModel;
        //        db = SOConverter.ToSODatabase(m);
        //    }
        //    else
        //    {
        //        PDPackage p = node.Tag as PDPackage;
        //        db = SOConverter.ToSODatabase(p);
        //    }

        //    BatchBuildCustomCode dialog = new BatchBuildCustomCode(db);
        //    dialog.ShowDialog();
        //}

        #endregion

        #region 表节点右键菜单事件处理

        //代码生成器
        private void menuItemBuildCodeForTable_Click(object sender, EventArgs e)
        {
            TreeNode    tn      = tv.SelectedNode;
            SOTable     table   = SOConverter.ToSOTable(tn.Tag as PDTable);
            CodeBuilder builder = null;

            //保证代码生成器使用一个实例
            if (this.DockPanel.ActiveDocument != null && this.DockPanel.ActiveDocument is CodeBuilder)
            {
                builder            = this.DockPanel.ActiveDocument as CodeBuilder;
                builder.Table      = table;
                builder.ColumnList = table.ColumnList;
                builder.LoadColumnList();
            }
            else
            {
                builder            = new CodeBuilder();
                builder.Table      = table;
                builder.ColumnList = table.ColumnList;
                builder.LoadColumnList();
                builder.Show(this.DockPanel);
            }
        }
コード例 #4
0
        //代码生成器
        private void menuItemBuildCodeForTable_Click(object sender, EventArgs e)
        {
            TreeNode tn = tvDatabase.SelectedNode;
            SOTable table = tn.Tag as SOTable;
            CodeBuilder builder = null;

            //保证代码生成器使用一个实例
            if (this.DockPanel.ActiveDocument != null && this.DockPanel.ActiveDocument is CodeBuilder)
            {
                builder = this.DockPanel.ActiveDocument as CodeBuilder;
                builder.Table = table;
                builder.ColumnList = dbSchema.GetTableColumnList(table);
                builder.LoadColumnList();
            }
            else
            {
                builder = new CodeBuilder();
                builder.Table = table;
                builder.ColumnList = dbSchema.GetTableColumnList(table);
                builder.LoadColumnList();//???:初始化列表CheckBox状态时,数据需要Load两次才能将CheckBox列全部初始化为选中状态
                builder.Show(this.DockPanel);
            }
        }
コード例 #5
0
ファイル: PdmExplorer.cs プロジェクト: Leafney/Kalman.Studio
        //使用自定义模板批量生成代码
        //private void menuItemBatchBuildCustomCode_Click(object sender, EventArgs e)
        //{
        //    SODatabase db = null;
        //    TreeNode node = tv.SelectedNode;

        //    if (node.Tag is PDModel)
        //    {
        //        PDModel m = node.Tag as PDModel;
        //        db = SOConverter.ToSODatabase(m);
        //    }
        //    else
        //    {
        //        PDPackage p = node.Tag as PDPackage;
        //        db = SOConverter.ToSODatabase(p);
        //    }

        //    BatchBuildCustomCode dialog = new BatchBuildCustomCode(db);
        //    dialog.ShowDialog();
        //}

        #endregion

        #region 表节点右键菜单事件处理

        //代码生成器
        private void menuItemBuildCodeForTable_Click(object sender, EventArgs e)
        {
            TreeNode tn = tv.SelectedNode;
            SOTable table = SOConverter.ToSOTable(tn.Tag as PDTable);
            CodeBuilder builder = null;

            //保证代码生成器使用一个实例
            if (this.DockPanel.ActiveDocument != null && this.DockPanel.ActiveDocument is CodeBuilder)
            {
                builder = this.DockPanel.ActiveDocument as CodeBuilder;
                builder.Table = table;
                builder.ColumnList = table.ColumnList;
                builder.LoadColumnList();
            }
            else
            {
                builder = new CodeBuilder();
                builder.Table = table;
                builder.ColumnList = table.ColumnList;
                builder.LoadColumnList();
                builder.Show(this.DockPanel);
            }
        }