예제 #1
0
        private void UpdateGroupedIndexList(DatabaseStatistics statistics)
        {
            var indexes          = statistics.Indexes;
            var currentSelection = ItemSelection.GetSelectedItems().Select(i => i.Name).ToHashSet();

            var indexGroups = from index in indexes
                              let groupDetails = GetIndexGroup(index.Name)
                                                 let indexGroup = groupDetails.Item1
                                                                  let indexOrder = groupDetails.Item2
                                                                                   orderby indexOrder
                                                                                   group index by indexGroup;

            var indexesAndGroupHeaders =
                indexGroups.SelectMany(group => new IndexListItem[] { new IndexGroupHeader {
                                                                          Name = group.Key
                                                                      } }
                                       .Concat(group.Select(index => new IndexItem {
                Name = index.Name, IndexStats = index
            })));

            GroupedIndexes.Clear();
            GroupedIndexes.AddRange(indexesAndGroupHeaders.ToList());

            var selection = GroupedIndexes.OfType <IndexItem>().Where(i => currentSelection.Contains(i.Name));

            ItemSelection.SetDesiredSelection(selection);
        }
예제 #2
0
        private void CleanGroupIndexes()
        {
            if (currentDatabase != ApplicationModel.Database.Value.Name || currentSearch != SearchText.Value)
            {
                currentDatabase = ApplicationModel.Database.Value.Name;
                currentSearch   = SearchText.Value;
                GroupedIndexes.Clear();
                return;
            }

            foreach (var groupedIndex in GroupedIndexes)
            {
                groupedIndex.Items.Clear();
            }
        }