public AsyncObservableCollection <GroupMemberItem> GetSortedGroupMembers()
        {
            AsyncObservableCollection <GroupMemberItem> items = this.ToCollection();

            items.Sort((x, y) => x.DisplayName.CompareTo(y.DisplayName));
            return(items);
        }
Example #2
0
        public static AsyncObservableCollection <T> GetItems <T>(this AsyncObservableCollection <T> collection, DummyItemType collectionType) where T : StoreItem, new()
        {
            AsyncObservableCollection <T> items = collection.ToCollection();

            items.Sort((x, y) => x.Title.CompareTo(y.Title));

            if (collectionType == DummyItemType.NoneType || collectionType == DummyItemType.AllNoneType)
            {
                T item = StoreItem.GetDummyItem <T>(DummyItemType.NoneType);
                items.Insert(0, item);
            }

            if (collectionType == DummyItemType.AllType || collectionType == DummyItemType.AllNoneType)
            {
                T item = StoreItem.GetDummyItem <T>(DummyItemType.AllType);
                items.Insert(0, item);
            }

            // If there are no items at all in the collection, throw an 'All' on the list
            if (items.Count == 0)
            {
                T item = StoreItem.GetDummyItem <T>(DummyItemType.AllType);
                items.Insert(0, item);
            }

            return(items);
        }