private void tsmiConnect_Click(object sender, EventArgs e) { FrmOpenDb openDb = new FrmOpenDb(); if (_dbClass != null) { openDb.SetDbType(_dbClass.GetClassDbType(), true); openDb.DbConnectConfigure = _dbConnectConfigure; } DialogResult dr = openDb.ShowDialog(this); if (dr == DialogResult.Cancel) { return; } else { CloseDb(); _dbConnectConfigure = openDb.DbConnectConfigure; SetTitle(); if (dr == DialogResult.OK) { SetDbClass(openDb.DbClass); ReInit(); } else { this.DbConnectConfigure = _dbConnectConfigure; } if (NewConnect != null) { NewConnect(this, e); } } }
void _frmDataBase_NewConnect(object sender, EventArgs e) { _dbConnectConfigure = _frmDataBase.DbConnectConfigure; UpdateNodeText(); FrmMain.Main.SaveConnectInfos(); }
private void NewConnectDb(DbConnectConfigure configure = null,ConnectInfo info = null, TreeNode node=null) { FrmOpenDb openDb = new FrmOpenDb(); DialogResult dr = openDb.ShowDialog(this); if (dr == DialogResult.Cancel) { return; } else { if (node == null) { node = new TreeNode(); tvConnectList.Nodes[0].Nodes.Add(node); } if (info==null) { info = new ConnectInfo(node); } node.Tag = info; info.DbConnectConfigure = openDb.DbConnectConfigure; if (dr == DialogResult.OK) { FrmDatabase frmdb = new FrmDatabase(openDb.DbClass); frmdb.DbConnectConfigure = info.DbConnectConfigure; info.FrmDataBase = frmdb; ShowOrActiveForm(frmdb); } info.Node = node; tvConnectList.ExpandAll(); SaveConnectInfos(); } }