private void listBoxTablets_SelectedIndexChanged(object sender, EventArgs e) { TabletInfo tablet = listBoxTablets.SelectedItem as TabletInfo; if (tablet != null) { RefreshServersComboBox(tablet.TableName); RefreshBalanceServerList(tablet); RefreshFailoverServerList(tablet); if (listBoxBalanceServers.Items.Count > 0) { listBoxBalanceServers.SelectedIndex = 0; buttonEnableBS.Enabled = true; } else { buttonEnableBS.Enabled = false; } if (listBoxFailoverServers.Items.Count > 0) { listBoxFailoverServers.SelectedIndex = 0; buttonEnableFS.Enabled = true; } else { buttonEnableFS.Enabled = false; } //CheckServerList(); } }
private void buttonAddFailoverServers_Click(object sender, EventArgs e) { TabletInfo tablet = listBoxTablets.SelectedItem as TabletInfo; if (tablet == null) { QAMessageBox.ShowErrorMessage("Please choose a tablet"); return; } ServerInfomation serverInfo = comboBoxFailoverServers.SelectedItem as ServerInfomation; if (serverInfo == null) { QAMessageBox.ShowErrorMessage("Please choose a server name"); return; } if (listBoxFailoverServers.Items.Contains(serverInfo)) { QAMessageBox.ShowErrorMessage("Can't input reduplicate server name!"); return; } listBoxFailoverServers.Items.Add(serverInfo); tablet.FailoverServers.Add(serverInfo); buttonEnableFS.Enabled = listBoxFailoverServers.Items.Count > 0; }
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 RefreshFailoverServerList(TabletInfo tablet) { listBoxFailoverServers.Items.Clear(); foreach (Hubble.Core.BigTable.ServerInfo serverInfo in tablet.FailoverServers) { listBoxFailoverServers.Items.Add(serverInfo); } }
private void buttonDelete_Click(object sender, EventArgs e) { TabletInfo tablet = listBoxTablets.SelectedItem as TabletInfo; if (tablet != null) { if (QAMessageBox.ShowQuestionMessage(string.Format("Are you sure you want to remove tablet: {0} ?", tablet.TableName)) == DialogResult.Yes) { listBoxTablets.Items.Remove(tablet); BigTableInfo.Tablets.Remove(tablet); if (listBoxTablets.Items.Count > 0) { listBoxTablets.SelectedIndex = 0; } } } }
private void buttonDelFailoverServers_Click(object sender, EventArgs e) { TabletInfo tablet = listBoxTablets.SelectedItem as TabletInfo; if (tablet == null) { QAMessageBox.ShowErrorMessage("Please choose a tablet"); return; } Hubble.Core.BigTable.ServerInfo serverInfo = listBoxFailoverServers.SelectedItem as Hubble.Core.BigTable.ServerInfo; if (serverInfo != null) { if (QAMessageBox.ShowQuestionMessage(string.Format("Are you sure you want to remove server: {0} ?", serverInfo.ServerName)) == DialogResult.Yes) { listBoxFailoverServers.Items.Remove(serverInfo); tablet.FailoverServers.Remove(serverInfo); } } buttonEnableFS.Enabled = listBoxFailoverServers.Items.Count > 0; }
private void listBoxTablets_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); Graphics g = e.Graphics; int index = e.Index; if (index >= 0) { bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected); TabletInfo tableinfo = listBoxTablets.Items[index] as TabletInfo; if (selected) { g.FillRectangle(new SolidBrush(Color.FromKnownColor(KnownColor.Highlight)), e.Bounds); } else { if (tableinfo.AllDisabled()) { g.FillRectangle(new SolidBrush(Color.Gray), e.Bounds); } else if (tableinfo.PartDisabled()) { g.FillRectangle(new SolidBrush(Color.Silver), e.Bounds); } else { g.FillRectangle(new SolidBrush(Color.White), e.Bounds); } } g.DrawString(tableinfo.TableName, listBoxTablets.Font, new SolidBrush(Color.Black), e.Bounds); e.DrawFocusRectangle(); } }