private void ReloadViewModel() { AchievementsOrdered.Clear(); var achievements = Enumerable.Empty <Achievement>(); if (achievementRepository != null) { achievements = achievementRepository.GetAchievements(); } foreach (var category in achievements.AsCategories()) { var sortedAchievements = category.Achievements .Where(a => IsUnlocked(achievements, a)) .OrderByDescending(a => a.IsCompleted) .ThenByDescending(a => a.DateCompleted) .ThenBy(a => a.Name); AchievementsOrdered.Add(new AchievementsPerCategory(sortedAchievements) { CategoryName = category.CategoryName, }); } }
private void ReloadViewModel() { AchievementsOrdered.Clear(); var achievements = Enumerable.Empty <Achievement>(); if (achievementService != null) { achievements = achievementService.GetAllAchievements(); } foreach (var category in achievements.AsCategories()) { var sortedAchievements = category.Achievements .Where(a => IsUnlocked(achievements, a)) .OrderByDescending(a => a.IsCompleted) .ThenByDescending(a => a.DateCompleted) .ThenBy(a => a.Name); if (sortedAchievements.Any()) { AchievementsOrdered.Add(new AchievementsPerCategory(sortedAchievements) { CategoryName = category.CategoryName, }); } } RaisePropertyChanged(OrderedAchievementsFieldName); RaisePropertyChanged(TotalCompletedFieldName); RaisePropertyChanged(PercentageCompletedFieldName); Messenger.Default.Send(new ResetAchievementsMessage()); }