private void OnStatisticListSelectionChanged() { if (this.statisticNameSelectedItems == null || this.statisticNameSelectedItems.Count == 0) { return; } if (this.statisticNameSelectedItems.Count == 0 || this.statisticNameSelectedItems.Contains(StatisticsViewModel.DefaultStatText)) { this.LoadDefaultList(); } else { this.sortByList = this.statisticNameSelectedItems.Select(o => StatisticHelper.FromDisplayText(o.ToString())).ToList(); var newPages = new List <StatValueViewModel>(this.sortByList.Count); foreach (var stat in this.sortByList) { var newPage = new StatValueViewModel(StatisticHelper.GetDisplayText(stat)); var statList = this.Settings.Statistics.Select(st => st[stat]).Distinct().ToList(); statList.Sort((o1, o2) => StatisticComparer.Default.Compare(o1, o2)); newPage.StatisticValues = statList; newPage.PropertyChanged += this.newPage_PropertyChanged; newPages.Add(newPage); } this.Pages = newPages; this.SelectedPage = newPages[0]; } }
static StatisticsViewModel() { StatisticsViewModel.emptyPage = new StatValueViewModel(StatisticsViewModel.DefaultStatText) { StatisticValues = new List<object>(1) {StatisticsViewModel.NoValuesToDisplay} }; }
static StatisticsViewModel() { StatisticsViewModel.emptyPage = new StatValueViewModel(StatisticsViewModel.DefaultStatText) { StatisticValues = new List <object>(1) { StatisticsViewModel.NoValuesToDisplay } }; }
private void OnStatisticListSelectionChanged() { if (this.statisticNameSelectedItems == null || this.statisticNameSelectedItems.Count == 0) { return; } if (this.statisticNameSelectedItems.Count == 0 || this.statisticNameSelectedItems.Contains(StatisticsViewModel.DefaultStatText)) { this.LoadDefaultList(); } else { this.sortByList = this.statisticNameSelectedItems.Select(o => StatisticHelper.FromDisplayText(o.ToString())).ToList(); var newPages = new List<StatValueViewModel>(this.sortByList.Count); foreach (var stat in this.sortByList) { var newPage = new StatValueViewModel(StatisticHelper.GetDisplayText(stat)); var statList = this.Settings.Statistics.Select(st => st[stat]).Distinct().ToList(); statList.Sort((o1, o2) => StatisticComparer.Default.Compare(o1, o2)); newPage.StatisticValues = statList; newPage.PropertyChanged += this.newPage_PropertyChanged; newPages.Add(newPage); } this.Pages = newPages; this.SelectedPage = newPages[0]; } }