private void TransferStock(string action) { bool showWindow = !AITurn(); //Establish the bool value now, before creating the Browse Stocks window Player targetPlayer; if (action == "take") { targetPlayer = NextPlayer(); } else { targetPlayer = AP(); } if (!HasStock(targetPlayer)) { MSG("Nothing to " + action + "!"); NextTurn(); return; } BrowseStocks bs = new BrowseStocks(targetPlayer, this, action); bs.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; if (showWindow) { try { bs.Show(); } catch (Exception ex) { MSG("Failed to show " + action + " Stock window:" + Environment.NewLine + ex.ToString()); } } }
private void dgvPlayers_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { BrowseStocks bi = new BrowseStocks(game.Players[e.RowIndex], game, "view"); bi.Show(); }