private void DeleteMatchRecieved(Match match) { var newMatches = State.Matches.ToList(); newMatches.RemoveAll(x => x.Guid == match.Guid); State.Matches = newMatches.ToArray(); NotifyPropertyChanged(nameof(State)); MatchDeleted?.Invoke(match); }
private void DeleteMatchReceived(Match match) { // TODO: This is garbage var newMatches = State.Matches.ToList(); newMatches.RemoveAll(x => x.Guid == match.Guid); State.Matches.Clear(); State.Matches.AddRange(newMatches); NotifyPropertyChanged(nameof(State)); MatchDeleted?.Invoke(match); }
public void DeleteMatch(Match match) { lock (State) { var newMatches = State.Matches.ToList(); newMatches.RemoveAll(x => x.Guid == match.Guid); State.Matches = newMatches.ToArray(); } NotifyPropertyChanged(nameof(State)); var @event = new Event(); @event.Type = Event.EventType.MatchDeleted; @event.ChangedObject = match; BroadcastToAllClients(new Packet(@event)); MatchDeleted?.Invoke(match); }