void ResetRankingCategoryItems() { RankingCategoryItems.Clear(); RankingCategoryItems.Add( new RankingCategoryHostListItem("好きなランキング") { ChildItems = RankingSettings.HighPriorityCategory .Select(x => new RankingCategoryListPageListItem(x.Category, true, OnRankingCategorySelected)) .ToList() } ); foreach (var categoryList in RankingCategories) { // 非表示ランキングを除外したカテゴリリストを作成 var label = categoryList.First().ToCulturelizeString(); var list = categoryList .Where(x => !RankingSettings.IsDislikeRankingCategory(x)) .Select(x => CreateRankingCategryListItem(x)) .ToList(); // 表示対象があればリストに追加 if (list.Count > 0) { RankingCategoryItems.Add(new RankingCategoryHostListItem(label) { ChildItems = list }); } } RaisePropertyChanged(nameof(RankingCategoryItems)); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { RankingCategoryItems.Clear(); RankingCategoryItems.Add( new RankingCategoryHostListItem("好きなランキング") { ChildItems = HohoemaApp.UserSettings.RankingSettings.HighPriorityCategory .Select(x => new RankingCategoryListPageListItem(x, true, OnRankingCategorySelected)) .ToList() } ); foreach (var categoryList in RankingCategories) { // 非表示ランキングを除外したカテゴリリストを作成 var label = categoryList.First().ToCultulizedText(); var list = categoryList .Where(x => !HohoemaApp.UserSettings.RankingSettings.IsDislikeRankingCategory(x)) .Select(x => CreateRankingCategryListItem(x)) .ToList(); // 表示対象があればリストに追加 if (list.Count > 0) { RankingCategoryItems.Add(new RankingCategoryHostListItem(label) { ChildItems = list }); } } OnPropertyChanged(nameof(RankingCategoryItems)); base.OnNavigatedTo(e, viewModelState); }