Exemple #1
0
        private void UpdateGroupedIndexList(DatabaseStatistics statistics)
        {
            Indexes.Clear();
            if (string.IsNullOrWhiteSpace(SearchText.Value))
            {
                Indexes.AddRange(statistics.Indexes.Where(stats => stats != null)
                                 .Select(stats => new IndexItem {
                    Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats
                }));
            }
            else
            {
                Indexes.AddRange(statistics.Indexes
                                 .Where(stats => stats != null && stats.Name.IndexOf(SearchText.Value, StringComparison.InvariantCultureIgnoreCase) != -1)
                                 .Select(stats => new IndexItem {
                    Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats
                }));
            }

            CleanGroupIndexes();
            foreach (var indexItem in Indexes)
            {
                var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
                if (groupItem == null)
                {
                    groupItem = new Group(indexItem.GroupName);
                    GroupedIndexes.Add(groupItem);
                }

                groupItem.Items.Add(indexItem);
            }

            OnPropertyChanged(() => GroupedIndexes);
        }
Exemple #2
0
        private void UpdateGroupedIndexList(DatabaseStatistics statistics)
        {
            Indexes.Clear();
            Indexes.AddRange(statistics.Indexes.Select(stats => new IndexItem {
                Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats
            }));

            CleanGroupIndexes();
            foreach (var indexItem in Indexes)
            {
                var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
                if (groupItem == null)
                {
                    groupItem = new Group(indexItem.GroupName);
                    GroupedIndexes.Add(groupItem);
                }

                groupItem.Items.Add(indexItem);
            }

            OnPropertyChanged(() => GroupedIndexes);
        }