示例#1
0
        private void manageTablesToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            ProjectExplorer prjExplorer = (ProjectExplorer)DockPanel.Controls.Find("Project Explorer", true)[0];
            EditWorkingTables ewt = new EditWorkingTables(dataSet, visibleTables);
            DialogResult result = ewt.ShowDialog();

            if (result == DialogResult.OK)
            {
                SetVisibleTables(ewt.VisibleTables);
                LoadDataSet(ewt.WorkDataSet);
            }
        }
        private void newDataSourceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.Nodes[0].Nodes.Count > 0)
                return;

            ConnectionWizard cwz = new ConnectionWizard();
            DialogResult cwzResult = cwz.ShowDialog();

            if (cwzResult == DialogResult.OK)
            {
                DataSet ds = cwz.GetDataSet();
                MainForm mf = (MainForm) FindForm().ParentForm;
                ModelForm frmModel = new ModelForm();
                frmModel.SqlSchema = cwz.SqlSchema;
                frmModel.Closed += new EventHandler(frmModel_Closed);

                EditWorkingTables ewt = new EditWorkingTables(ds, new List<string>());
                DialogResult result = ewt.ShowDialog();
                if (result == DialogResult.OK)
                {
                    treeView1.Nodes[0].Nodes.Add(ds.DataSetName);
                    treeView1.Nodes[0].Expand();
                    frmModel.Show(mf.DockPanel);

                    frmModel.SetZoom(75);
                    frmModel.SetVisibleTables(ewt.VisibleTables);
                    frmModel.LoadDataSet(ewt.WorkDataSet);
                }
            }
        }