public void RemovePlayer(Player player) { _ = player ?? throw new ArgumentNullException(); if (!PlayersList.Remove(player)) { throw new InvalidOperationException("Player does not found"); } }
public void LeaveSquare(ClientSession cs) { using (OutPacket oPacket = new OutPacket(GameOpcodes.EVENT_LEAVE_SQUARE_ACK)) { PlayersList.Remove(cs); oPacket.WriteInt(0); oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT); cs.Send(oPacket); } }
private void DeleteSelected() { var dialogResult = MessageBox.Show($"Czy na pewno chcesz usunąć {Environment.NewLine} {Selected}?", "Usuwanie", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { PlayersList.Remove(Selected); } Clear(); Selected = null; }
private void Search(string searchText) { int current = Convert.ToInt32(HiddenFieldCurrentPage.Value) - 1; int total = Convert.ToInt32(HiddenFieldTotalPages.Value); PlayersList playersList = new PlayersList(); if (TextBoxSearchBox.Text == "") playersList.GetAll(current == 0 ? 0 : ((current * itemsPerPage) + 1), current == 0 ? itemsPerPage : itemsPerPage - 1); else playersList.GetByLikeName(TextBoxSearchBox.Text, current == 0 ? 0 : ((current * itemsPerPage) + 1), current == 0 ? itemsPerPage : itemsPerPage - 1); // If exact match found, move to the top of the list. DotaDbGenLib.Business.Players player = playersList.Find(x => x.PersonaName == TextBoxSearchBox.Text); if (player != null) { playersList.Remove(player); playersList.Insert(0, player); } ListViewPlayers.DataSource = playersList; ListViewPlayers.DataBind(); }