public void Handle(ResultsChangedEvent message) { List <Rally> ralliesSelected = message.Rallies.ToList(); totalRalliesCount = ralliesSelected.Count(); PointsPlayer1 = ralliesSelected.Where(r => r.Winner == MatchPlayer.First).Count(); PointsPlayer2 = ralliesSelected.Where(r => r.Winner == MatchPlayer.Second).Count(); PointsPlayer1Percent = Math.Round((PointsPlayer1 / totalRalliesCount) * 100, 2) + " %"; PointsPlayer2Percent = Math.Round((PointsPlayer2 / totalRalliesCount) * 100, 2) + " %"; NotifyOfPropertyChange("PointsPlayer1"); NotifyOfPropertyChange("PointsPlayer2"); NotifyOfPropertyChange("PointsPlayer1Percent"); NotifyOfPropertyChange("PointsPlayer2Percent"); NotifyOfPropertyChange("Player1"); NotifyOfPropertyChange("Player2"); NotifyOfPropertyChange("totalRalliesCount"); }
/// <summary> /// Write out the results to file. /// </summary> public void WriteOutResults() { _dataSerializer.SerializeObject(_results, _path + @"\" + Resources.TypingResults); ResultsChangedEvent?.Invoke(this, System.EventArgs.Empty); }