private void button1_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.None; if (cbxDataBase.Text.Trim().Length == 0) { MessageBox.Show("Select the database first"); } else { if (SetIPandPort()) { frmProgress pro = new frmProgress(CliUtils.fRemoteIP, CliUtils.fRemotePort, "Connect to server"); if (pro.ShowDialog() == DialogResult.OK) { if (pro.Module != null) { object[] myRet = pro.Module.CallMethod(new object[] { CliUtils.GetBaseClientInfo() } , "GLModule", "GetDB", null); if (myRet[1] != null && myRet[1] is ArrayList && myRet[2] != null && myRet[2] is ArrayList) { ArrayList dbList = (ArrayList)myRet[1]; for (int i = 0; i < dbList.Count; i++) { string db = dbList[i].ToString(); if (DBSplit.Contains(db)) { DBSplit[db] = ((ArrayList)myRet[2])[i].ToString(); } else { DBSplit.Add(db, ((ArrayList)myRet[2])[i].ToString()); } } } this.DialogResult = DialogResult.OK; } } } } }
private void btnRefresh_Click(object sender, EventArgs e) { cbxDataBase.Text = string.Empty; cbxDataBase.Items.Clear(); if (SetIPandPort()) { frmProgress pro = new frmProgress(CliUtils.fRemoteIP, CliUtils.fRemotePort, "Refresh database list"); if (pro.ShowDialog() == DialogResult.OK) { EEPRemoteModule module = pro.Module; if (module != null) { try { object[] myRet = module.CallMethod(new object[]{ CliUtils.GetBaseClientInfo() } , "GLModule", "GetDB", null); if (myRet[1] != null && myRet[1] is ArrayList && myRet[2] != null && myRet[2] is ArrayList) { ArrayList dbList = (ArrayList)myRet[1]; for (int i = 0; i < dbList.Count; i++) { string db = dbList[i].ToString(); this.cbxDataBase.Items.Add(db); if (DBSplit.Contains(db)) { DBSplit[db] = ((ArrayList)myRet[2])[i].ToString(); } else { DBSplit.Add(db, ((ArrayList)myRet[2])[i].ToString()); } } } } catch (Exception e1) { MessageBox.Show(e1.Message); } } } } }