private void buttonAdd_Click(object sender, EventArgs e) { try { #if HubblePro FormBigTableBatchInsert frmBigtableBatchInsert = new FormBigTableBatchInsert(); frmBigtableBatchInsert.BigTableInfo = this.BigTableInfo; if (frmBigtableBatchInsert.ShowDialog() == DialogResult.OK) { RefreshTabletGUI(); } #else string tableName = null; string connectionString = ""; if (QAMessageBox.ShowInputBox("Add tablet", "Input table name", ref tableName) == DialogResult.OK) { if (string.IsNullOrEmpty(tableName)) { QAMessageBox.ShowErrorMessage("table name can't be empty!"); return; } TabletInfo tablet = new TabletInfo(tableName, new Hubble.Core.BigTable.ServerInfo("", connectionString)); BigTableInfo.Add(tablet); listBoxTablets.Items.Add(tablet); listBoxTablets.SelectedItem = tablet; } #endif } catch (Exception ex) { QAMessageBox.ShowErrorMessage(ex.Message); } }
private void buttonAddServer_Click(object sender, EventArgs e) { string serverName = ""; string connectionString = ""; if (QAMessageBox.ShowInputBox("Server name", "Please input server name", ref serverName) == DialogResult.OK) { if (string.IsNullOrEmpty(serverName)) { QAMessageBox.ShowErrorMessage("server name can't be empty!"); return; } if (QAMessageBox.ShowInputBox("Server name", "Please input connection string", ref connectionString) == DialogResult.OK) { if (string.IsNullOrEmpty(connectionString)) { QAMessageBox.ShowErrorMessage("connection string can't be empty!"); return; } Hubble.Core.BigTable.ServerInfo serverInfo = new Hubble.Core.BigTable.ServerInfo(serverName, connectionString); if (BigTableInfo.ServerList.Contains(serverInfo)) { QAMessageBox.ShowErrorMessage("Can't input reduplicate server name!"); return; } BigTableInfo.ServerList.Add(new Hubble.Core.BigTable.ServerInfo(serverName, connectionString)); ListViewItem item = new ListViewItem(new string[] { "True", serverName, connectionString }); listViewServers.Items.Add(item); InitListViewItem(item); RefreshDatabaseTableEnumerate(); } } }