/// <summary> /// Locks Single Button /// </summary> /// <param name="sender">should be ToolStripMenuItem</param> /// <param name="e"></param> private void LockButton_Click(object sender, EventArgs e) { if (sender is ToolStripMenuItem) { ToolStripMenuItem tsi = (ToolStripMenuItem)sender; PlayerButtonContextMenuStrip pbcms = (PlayerButtonContextMenuStrip)tsi.GetCurrentParent(); // Set Caption correctly as it can also get changed by "LockAllButtons", etc string displayedText = tsi.Text; if (displayedText.Equals("Lock")) { PlayerButtonContextMenuActions.lockSeat(pbcms.seatname, pbcms.tablename); tsi.Text = "Unlock"; } else { PlayerButtonContextMenuActions.unlockSeat(pbcms.seatname, pbcms.tablename); tsi.Text = "Lock"; } } else { throw new Exception("Sender is no ToolStripMenuItem!"); } }
/// <summary> /// Display Debug Table Data Form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DisplayDebugTableData_Click(object sender, EventArgs e) { if (sender is ToolStripMenuItem) { ToolStripMenuItem tsi = (ToolStripMenuItem)sender; PlayerButtonContextMenuStrip pbcms = (PlayerButtonContextMenuStrip)tsi.GetCurrentParent(); PlayerButtonContextMenuActions.displayDebugTableData(pbcms.tablename); } else { throw new Exception("Sender is no ToolStripMenuItem!"); } }
/// <summary> /// Remove Single Button /// </summary> /// <param name="sender">should be ToolStripMenuItem</param> /// <param name="e"></param> private void RemoveButton_Click(object sender, EventArgs e) { if (sender is ToolStripMenuItem) { ToolStripMenuItem tsi = (ToolStripMenuItem)sender; PlayerButtonContextMenuStrip pbcms = (PlayerButtonContextMenuStrip)tsi.GetCurrentParent(); PlayerButtonContextMenuActions.removeSeatFromTable(pbcms.seatname, pbcms.tablename); } else { throw new Exception("Sender is no ToolStripMenuItem!"); } }
/// <summary> /// Change Nickname manually /// </summary> /// <param name="sender">should be ToolStripMenuItem</param> /// <param name="e"></param> private void changeNicknameManually_Click(object sender, EventArgs e) { /* * Whats need to change? * 1. nickname in SeatData --> via tabledata * 2. text in PlayerButton --> via PlayerButtonHandler */ if (sender is ToolStripMenuItem) { ToolStripMenuItem tsi = (ToolStripMenuItem)sender; PlayerButtonContextMenuStrip pbcms = (PlayerButtonContextMenuStrip)tsi.GetCurrentParent(); PlayerButtonContextMenuActions.renameSeat(pbcms.seatname, pbcms.tablename); } else { throw new Exception("Sender is no ToolStripMenuItem!"); } }