Refactor: items with DynamicData
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user