예제 #1
0
        private bool IsSearchMatch(StashItemViewModel itemVm)
        {
            // search in base type name, flavour text, name, properties and mods
            var i          = itemVm.Item;
            var modstrings = new[] {
                i.BaseType.Name,
                i.FlavourText,
                i.Name
            }.Union(i.Properties.Select(p => p.Attribute)).Union(i.Mods.Select(m => m.Attribute));

            return(modstrings.Any(s => s != null && s.ToLower().Contains(SearchText)));
        }
예제 #2
0
        public void AddItem(Item item, bool scrollToItem)
        {
            var itemVm = new StashItemViewModel(item);

            Items.Add(itemVm);

            if (!scrollToItem)
            {
                return;
            }
            if (!_inBatchUpdate)
            {
                ScrollBarValue = item.Y;
            }
            else if (item.Y < _smallestAddedItemY)
            {
                _smallestAddedItemY = item.Y;
            }
        }
예제 #3
0
        public void Initialize(IExtendedDialogCoordinator dialogCoordinator, IPersistentData persistentData)
        {
            _dialogCoordinator = dialogCoordinator;
            _persistentData    = persistentData;

            // add view models for bookmarks and items
            // PersistentData.StashBookmarks and PersistentData.StashItems may only be changed through the stash after this
            BeginUpdate();
            Bookmarks.AddRange(persistentData.StashBookmarks.Select(b => new StashBookmarkViewModel(b)));
            Bookmarks.CollectionChanged += (sender, args) => RowsChanged();
            foreach (var stashItem in persistentData.StashItems)
            {
                var item = new StashItemViewModel(stashItem);
                item.PropertyChanging += ItemOnPropertyChanging;
                item.PropertyChanged  += ItemOnPropertyChanged;
                Items.Add(item);
            }
            Items.CollectionChanged += ItemsOnCollectionChanged;
            EndUpdate();
        }