Refactor: items with DynamicData

This commit is contained in:
2022-04-22 09:09:14 +02:00
parent da3ccf4317
commit 76c6e30154
31 changed files with 281 additions and 141 deletions

View File

@@ -0,0 +1,26 @@
using System.Collections.ObjectModel;
using DynamicData;
namespace FileTime.App.Core.Models
{
public class BindedCollection<T> : IDisposable
{
private readonly IDisposable _disposable;
public ReadOnlyObservableCollection<T> Collection { get; }
public BindedCollection(IObservable<IChangeSet<T>> dynamicList)
{
_disposable = dynamicList
.Bind(out var collection)
.DisposeMany()
.Subscribe();
Collection = collection;
}
public void Dispose()
{
_disposable.Dispose();
GC.SuppressFinalize(this);
}
}
}