private void _editTableForm_VisibleChanged( object sender, EventArgs e ) { if ( !_editTableForm.Visible ) { SelectedTable = null; _mainDetailsForm.RefreshData(); _mainDetailsForm.Show(); } else { _mainDetailsForm.Hide(); } }
// called when a pool table control is clicked private void table_Click(object sender, EventArgs e) { try { PoolTableControl activeTable = (PoolTableControl)sender; if ( _editTableForm.Status != EditTableStatus.MovingPlayers ) { if ( activeTable.Status == TableStatus.Inactive ) { _editTableForm.Hide(); AddTableForm newTableForm = new AddTableForm( activeTable.TableNum ); newTableForm.ShowDialog(); } else if ( activeTable.Status == TableStatus.Active ) { SelectedTable = activeTable; _editTableForm.SetCurrentTable( activeTable.TableNum ); } } else if ( _editTableForm.Status == EditTableStatus.MovingPlayers && _editTableForm.CurrentTable != null ) { if ( _editTableForm.CurrentTable.TableNum == activeTable.TableNum ) { return; } _editTableForm.MovePlayers( activeTable.TableNum ); if ( _editTableForm.Status == EditTableStatus.Done ) { SelectedTable = activeTable; _editTableForm.SetCurrentTable( activeTable.TableNum ); } } _mainDetailsForm.RefreshData(); } catch { MessageBox.Show( "Hmmm... A database error occurred. Try again, then restart the program and/or the computer " + "if the error persists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); _editTableForm.Hide(); } }