private void UpdateSchoolScores(IEnumerable <SchoolScoreDto> schools) { foreach (var school in schools) { SchoolScore score; if (!_schoolScores.TryGetValue(school.Id, out score)) { score = new SchoolScore { Id = school.Id }; _schoolScores.Add(school.Id, score); } score.Name = school.Name; score.UpdateHouseScores(school.Houses); } if (!_isInitialized) { if (Initialized != null) { Initialized(); } _isInitialized = true; } }
private void UpdateSchoolScores(IEnumerable<SchoolScoreDto> schools) { foreach (var school in schools) { SchoolScore score; if (!_schoolScores.TryGetValue(school.Id, out score)) { score = new SchoolScore { Id = school.Id }; _schoolScores.Add(school.Id, score); } score.Name = school.Name; score.UpdateHouseScores(school.Houses); } if (!_isInitialized) { if (Initialized != null) Initialized(); _isInitialized = true; } }
private void AddHouse(SchoolScore school, string houseName, int id) { school.UpdateHouseScores(new[] { new HouseScoreDto { Id = id, Name = houseName, Amount = 0 } }); }
private void IncrementHouse(KeyboardState ks, SchoolScore school) { if (ks.IsKeyPressedOnce(Keys.D1)) school.HouseScores.ToArray()[0].Amount += _inc; if (ks.IsKeyPressedOnce(Keys.D2)) school.HouseScores.ToArray()[1].Amount += _inc; if (ks.IsKeyPressedOnce(Keys.D3)) school.HouseScores.ToArray()[2].Amount += _inc; if (ks.IsKeyPressedOnce(Keys.D4)) school.HouseScores.ToArray()[3].Amount += _inc; }
private void AddSchool(string schoolName, params string[] houseNames) { SchoolScore school = new SchoolScore { Name = schoolName }; school.Amount = 0; for (int i = 0; i < houseNames.Length; i++) { AddHouse(school, houseNames[i], i); } _schoolScores.Add(school); }