ItemsCollection on Container

This commit is contained in:
2023-02-27 09:00:30 +01:00
parent a01c3a69b4
commit ffbd7b154c
11 changed files with 26 additions and 103 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using DynamicData;
@@ -13,6 +14,7 @@ public abstract class ContentProviderBase : IContentProvider
private readonly IObservable<IChangeSet<AbsolutePath, string>> _items;
protected SourceCache<AbsolutePath, string> Items { get; } = new(p => p.Path.Path);
public ReadOnlyObservableCollection<AbsolutePath> ItemsCollection { get; }
protected ExtensionCollection Extensions { get; }
IObservable<IChangeSet<AbsolutePath, string>> IContainer.Items => _items;
@@ -61,6 +63,8 @@ public abstract class ContentProviderBase : IContentProvider
Extensions = new ExtensionCollection();
_extensions = Extensions.AsReadOnly();
_items = Items.Connect().StartWithEmpty();
_items.Bind(out var items).Subscribe();
ItemsCollection = items;
}
public virtual Task OnEnter() => Task.CompletedTask;