Exemple #1
0
 private void RemoveItemFromSubgroupsByExhaustiveSearch(CollectionViewGroupInternal group, object item)
 {
     if (!this.RemoveFromGroupDirectly(group, item))
     {
         return;
     }
     for (int index = group.Items.Count - 1; index >= 0; --index)
     {
         CollectionViewGroupInternal group1 = group.Items[index] as CollectionViewGroupInternal;
         if (group1 != null)
         {
             this.RemoveItemFromSubgroupsByExhaustiveSearch(group1, item);
         }
     }
 }
Exemple #2
0
        private void RemoveEmptyGroup(CollectionViewGroupInternal group)
        {
            CollectionViewGroupInternal parent = group.Parent;

            if (parent == null)
            {
                return;
            }
            GroupDescription groupBy = parent.GroupBy;

            if (parent.ProtectedItems.IndexOf((object)group) < groupBy.GroupNames.Count)
            {
                return;
            }
            parent.Remove((object)group, false);
        }
Exemple #3
0
        internal int LeafIndexFromItem(object item, int index)
        {
            int num = 0;
            CollectionViewGroupInternal viewGroupInternal1 = this;

            while (viewGroupInternal1 != null)
            {
                int index1 = 0;
                for (int count = viewGroupInternal1.Items.Count; index1 < count && (index >= 0 || !object.Equals(item, viewGroupInternal1.Items[index1])) && index != index1; ++index1)
                {
                    CollectionViewGroupInternal viewGroupInternal2 = viewGroupInternal1.Items[index1] as CollectionViewGroupInternal;
                    num += viewGroupInternal2 == null ? 1 : viewGroupInternal2.ItemCount;
                }
                item = (object)viewGroupInternal1;
                viewGroupInternal1 = viewGroupInternal1.Parent;
                index = -1;
            }
            return(num);
        }
Exemple #4
0
        private bool RemoveFromSubgroup(object item, CollectionViewGroupInternal group, int level, object name)
        {
            bool flag  = false;
            int  index = 0;

            for (int count = group.Items.Count; index < count; ++index)
            {
                CollectionViewGroupInternal group1 = group.Items[index] as CollectionViewGroupInternal;
                if (group1 != null && group.GroupBy.NamesMatch(group1.Name, name))
                {
                    if (this.RemoveFromSubgroups(item, group1, level + 1))
                    {
                        flag = true;
                    }
                    return(flag);
                }
            }
            return(true);
        }
Exemple #5
0
        private void InitializeGroup(CollectionViewGroupInternal group, int level)
        {
            GroupDescription groupDescription = level < this.GroupDescriptions.Count ? this.GroupDescriptions[level] : (GroupDescription)null;

            group.GroupBy = groupDescription;
            ObservableCollection <object> observableCollection = groupDescription != null ? groupDescription.GroupNames : (ObservableCollection <object>)null;

            if (observableCollection != null)
            {
                int index = 0;
                for (int count = observableCollection.Count; index < count; ++index)
                {
                    CollectionViewGroupInternal group1 = new CollectionViewGroupInternal(observableCollection[index], group);
                    this.InitializeGroup(group1, level + 1);
                    group.Add((object)group1);
                }
            }
            group.LastIndex = 0;
        }
Exemple #6
0
        protected void ChangeCounts(object item, int delta)
        {
            bool flag = !(item is CollectionViewGroup);

            for (CollectionViewGroupInternal group = this; group != null; group = group.parentGroup)
            {
                group.FullCount += delta;
                if (flag)
                {
                    CollectionViewGroupInternal viewGroupInternal = group;
                    int num = viewGroupInternal.ProtectedItemCount + delta;
                    viewGroupInternal.ProtectedItemCount = num;
                    if (group.ProtectedItemCount == 0)
                    {
                        this.RemoveEmptyGroup(group);
                    }
                }
            }
            ++this.version;
        }
Exemple #7
0
 public LeafEnumerator(CollectionViewGroupInternal group)
 {
     this.group = group;
     this.DoReset();
 }
Exemple #8
0
 internal CollectionViewGroupInternal(object name, CollectionViewGroupInternal parent)
     : base(name)
 {
     this.parentGroup = parent;
 }