Exemplo n.º 1
0
        public static AsyncObservableCollection <T> GetItems <T>(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);
            }

            return(items);
        }
Exemplo n.º 2
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Undoes all changes that are currently queued up to be saved.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void UndoChanges()
        {
            AsyncObservableCollection <StoreItem> changedItems = m_changedItems.ToCollection();

            changedItems.Sort((x, y) => StoreItemTypeSort.Compare(x, y));

            UndoInProgress = true;
            foreach (StoreItem item in changedItems)
            {
                if (item.IsNew)
                {
                    m_changedItems.Remove(item);
                    RemoveFromCache(item);
                }
                else
                {
                    item.UndoChanges();
                }
            }

            UndoInProgress = false;
        }
Exemplo n.º 3
0
        public static AsyncObservableCollection <T> GetItems <T>(AsyncObservableCollection <T> collection, DummyItemType collectionType, string sortPropName) where T : StoreItem, new()
        {
            AsyncObservableCollection <T> items = collection.ToCollection();

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

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

            ItemPropertySort <T> itemComparer = new ItemPropertySort <T>(sortPropName, System.ComponentModel.ListSortDirection.Ascending);

            items.Sort((x, y) => itemComparer.Compare(x, y));

            return(items);
        }
Exemplo n.º 4
0
        void SortMembersByDisplayName(AsyncObservableCollection <GroupMemberItem> members)
        {
            ItemPropertySort <GroupMemberItem> itemComparer = new ItemPropertySort <GroupMemberItem>(StringUtils.GetPropertyName((GroupMemberItem s) => s.DisplayName), System.ComponentModel.ListSortDirection.Ascending);

            members.Sort((x, y) => itemComparer.Compare(x, y));
        }