public void UpdateMatchRecieved(Match match) { var newMatches = State.Matches.ToList(); newMatches[newMatches.FindIndex(x => x.Guid == match.Guid)] = match; State.Matches = newMatches.ToArray(); NotifyPropertyChanged(nameof(State)); MatchInfoUpdated?.Invoke(match); }
public void UpdateMatchReceived(Match match) { // TODO: This is garbage var newMatches = State.Matches.ToList(); newMatches[newMatches.FindIndex(x => x.Guid == match.Guid)] = match; State.Matches.Clear(); State.Matches.AddRange(newMatches); NotifyPropertyChanged(nameof(State)); MatchInfoUpdated?.Invoke(match); }
public void UpdateMatch(Match match) { lock (State) { var newMatches = State.Matches.ToList(); newMatches[newMatches.FindIndex(x => x.Guid == match.Guid)] = match; State.Matches = newMatches.ToArray(); } NotifyPropertyChanged(nameof(State)); var @event = new Event(); @event.Type = Event.EventType.MatchUpdated; @event.ChangedObject = match; var updatePacket = new Packet(@event); BroadcastToAllClients(updatePacket); MatchInfoUpdated?.Invoke(match); }