Ejemplo n.º 1
0
        public IPreviewList GetItemPreviewMetadata(IReadOnlyList <string> filters)
        {
            var lowerFilters = filters.Select(f => f.ToLowerInvariant()).ToList();

            var previewList = new PreviewList(
                list => _lock.Write(() => _previewStreams.Remove(list)),
                items => _tagManager.Filter(items, lowerFilters));

            _lock.Read(() => previewList.AddFiltered(_previewModels));
            _lock.Write(() => _previewStreams.Add(previewList));

            return(previewList);
        }
Ejemplo n.º 2
0
        public IPreviewList GetItemPreviewMetadata(IReadOnlyList <string> filters)
        {
            var lowerFilters = filters.Select(f => f.ToLowerInvariant()).ToList();

            bool MatchesFilters(ItemPreviewModel m) => lowerFilters.All(m.Tags.Contains);

            var previewList = new PreviewList(
                list => WriteLocked(() => _previewStreams.Remove(list)),
                items => items.Where(MatchesFilters).ToList());

            ReadLocked(() => previewList.AddFiltered(_previewModels));
            WriteLocked(() => _previewStreams.Add(previewList));

            return(previewList);
        }