GroupBucketCollection GetBuckets() { GroupBucketCollection buckets = new GroupBucketCollection(); GroupBucket bucket = new GroupBucket(); buckets.Add(bucket); int index = 0; foreach (UIElement e in Controls) { bool canBeSmall = CanControlBeSmall(e); if (!canBeSmall && bucket.Count > 0) { bucket = new GroupBucket(); buckets.Add(bucket); } else { bucket.Add(index); } index++; } return(buckets); }
private void AddAccountToBuckets(SortedSet <GroupBucket> buckets, int id, Group group, bool isImport) { GroupBucket currentBucket = new GroupBucket(group); if (buckets.TryGetValue(currentBucket, out currentBucket)) { if (isImport) { currentBucket.Ids.Load(id); } else { currentBucket.Ids.DelayAdd(id); } } else { currentBucket.Key = group; currentBucket.Ids = DelaySortedList <int> .CreateDefault(); currentBucket.Ids.Load(id); buckets.Add(currentBucket); } }