private void RemovePlayerFromBan(object sender, RoutedEventArgs e) { var playerForRemove = BannedPlayers.FirstOrDefault( player => player.Name.ToLower() == PlayerNameTextBox.Text.ToLower() && player.Realm.ToLower() == SelectedPlayerServerName.ToLower()); if (playerForRemove == null) { MessageBox.Show("Игрок не найден"); return; } BannedPlayers.Remove(playerForRemove); }
private void UpdateBannedGuildsAndPeoples() { foreach (var bannedGuild in BannedGuilds.ToArray()) { var guild = _explorer.GetGuild(Region.EU, bannedGuild.Realm, bannedGuild.Name, GuildOptions.GetMembers); Parallel.ForEach(guild.Members, member => { member.FullCharactor = _explorer.GetCharacter(Region.EU, member.GuildCharacter.Realm, member.GuildCharacter.Name, CharacterOptions.GetPetSlots); }); BannedGuilds.Remove(bannedGuild); BannedGuilds.Add(guild); } foreach (var bannedPlayer in BannedPlayers.ToArray()) { var updated = _explorer.GetCharacter(bannedPlayer.Realm, bannedPlayer.Name, CharacterOptions.GetPetSlots); BannedPlayers.Remove(bannedPlayer); BannedPlayers.Add(updated); } }
public void RemoveBan(PlayerBan ban) { BannedPlayers.Remove(ban); Config.Save(); }