public void UpdatePlayers(string name) { if (guiActivity.InvokeRequired) { UpdatePlayerList del = new UpdatePlayerList(UpdatePlayers); this.srvPlayerlist.Invoke(del, new object[] { name }); } else { this.srvPlayerlist.Items.Add(name); } }
public void DrawCardFromPlayer(int cardIndex, int playerIndex, int nextPlayerIndex) { PlayerLost(players[nextPlayerIndex]); if (players[playerIndex].lost) { Debug.WriteLine(players[playerIndex].playerName + " lost the game"); Lostgame?.Invoke(this, EventArgs.Empty); // her vægger et envent Lostgame return; } players[playerIndex].DrawFromPlayer(players[nextPlayerIndex], cardIndex); UpdatePlayerList?.Invoke(this, EventArgs.Empty); // her vægger et envent UpdatePlayerList }