private void btnChooseOtherServer_Click(object sender, EventArgs e) { var db = TreeSelectForm.SelectDatabase(); if (db != null) { Async.SafeClose(m_conn.Connection); SetDatabase(db.CloneSource()); } }
public static IPhysicalConnection SelectQueryableConnection() { TreeSelectForm win = new TreeSelectForm(); win.daTreeView1.TreeBehaviour.ShowFilter = node => node.IsQueryableNodeOrParent(); win.daTreeView1.RootPath = "data:"; if (win.ShowDialogEx() == DialogResult.OK) { return(win.daTreeView1.Selected.GetConnection()); } return(null); }
public static IDatabaseSource SelectDatabase() { TreeSelectForm win = new TreeSelectForm(); win.daTreeView1.TreeBehaviour.ShowFilter = node => node.IsDatabaseNodeOrParent(); win.daTreeView1.TreeBehaviour.AllowDoubleClickNodeHandling = false; win.daTreeView1.RootPath = "data:"; win.SelectedOk += new EventHandler <CheckSelectedOkEventArgs>(win_SelectedOk); if (win.ShowDialogEx() == DialogResult.OK) { var node = win.daTreeView1.Selected as IDatabaseTreeNode; if (node != null) { return(node.DatabaseConnection); } } return(null); }