/// <summary> /// Resets the player IDs to their position in the complete player Array. /// </summary> public void ResetPlayerIDs() { foreach (PlayerViewModel item in AllPlayers) { item.PlayerID = AllPlayers.IndexOf(item); } }
private void SwitchSelect(object obj) { IEnumerable args = obj as IEnumerable; List <PlayerCollectionItem> switchPlayers = new List <PlayerCollectionItem>(args.OfType <PlayerCollectionItem>()); if (!switchPlayers.Any()) { return; } if (PlayersInAlias.Contains(switchPlayers[0])) { int index = PlayersInAlias.IndexOf(switchPlayers[0]); switchPlayers.ForEach(player => { PlayersInAlias.Remove(player); AllPlayers.Add(player); player.LinkedAliases.Add(newAlias); }); SelectedPlayersSelectdIndex = index + 1 > PlayersInAlias.Count ? 0 : index; } else { int index = AllPlayers.IndexOf(switchPlayers[0]); switchPlayers.ForEach(player => { PlayersInAlias.Add(player); AllPlayers.Remove(player); player.LinkedAliases.Remove(newAlias); }); AllPlayersSelectdIndex = index + 1 > AllPlayers.Count ? 0 : index; } }