Got adding working again
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record Aggerate<TValue, TOptions>(TOptions? Options = null) :
|
||||
IAggerate
|
||||
where TOptions : class
|
||||
{
|
||||
public object? Key { get; init; }
|
||||
|
||||
public AggerateMode Mode { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public class AggerateAttribute(object key,
|
||||
AggerateMode mode = AggerateMode.Reset) : NotificationAttribute(key)
|
||||
{
|
||||
public AggerateMode Mode => mode;
|
||||
}
|
||||
@@ -1,12 +1,31 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record AggerateEventArgs<TValue> :
|
||||
public record Aggerate
|
||||
{
|
||||
public static AggerateEventArgs<TValue, TOptions> With<TValue, TOptions>(TOptions options) where TOptions : class
|
||||
{
|
||||
return new AggerateEventArgs<TValue, TOptions>(options);
|
||||
}
|
||||
|
||||
public static AggerateEventArgs<TValue> With<TValue>()
|
||||
{
|
||||
return new AggerateEventArgs<TValue>();
|
||||
}
|
||||
}
|
||||
|
||||
public record AggerateEventArgs<TValue, TOptions>(TOptions? Options = null) :
|
||||
IAggerate
|
||||
where TOptions : class
|
||||
{
|
||||
public object? Key { get; init; }
|
||||
|
||||
public AggerateMode Mode { get; init; }
|
||||
}
|
||||
|
||||
public record AggerateEventArgs<TValue> :
|
||||
IAggerate
|
||||
{
|
||||
public object? Key { get; init; }
|
||||
|
||||
public static Aggerate<TValue, TOptions> With<TOptions>(TOptions options) where TOptions : class
|
||||
{
|
||||
return new Aggerate<TValue, TOptions>(options);
|
||||
}
|
||||
public AggerateMode Mode { get; init; }
|
||||
}
|
||||
@@ -5,9 +5,3 @@ public class NotificationAttribute(object key) : Attribute
|
||||
{
|
||||
public object Key => key;
|
||||
}
|
||||
|
||||
public class EnumerateAttribute(object key,
|
||||
AggerateMode mode = AggerateMode.Reset) : NotificationAttribute(key)
|
||||
{
|
||||
public AggerateMode Mode => mode;
|
||||
}
|
||||
@@ -250,9 +250,9 @@ public partial class ObservableCollection<TItem> :
|
||||
Disposer.Dispose(this);
|
||||
}
|
||||
|
||||
public void Aggerate()
|
||||
public void BeginAggregation()
|
||||
{
|
||||
if (this.GetAttribute<EnumerateAttribute>() is EnumerateAttribute attribute)
|
||||
if (this.GetAttribute<AggerateAttribute>() is AggerateAttribute attribute)
|
||||
{
|
||||
if (attribute.Mode == AggerateMode.Reset)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ public partial class ObservableCollection<TItem> :
|
||||
}
|
||||
|
||||
object? key = this.GetPropertyValue(() => attribute.Key) is { } value ? value : attribute.Key;
|
||||
Publisher.PublishUI(OnAggerate(key));
|
||||
Publisher.PublishUI(OnPrepareAggregation(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ public partial class ObservableCollection<TItem> :
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
Aggerate();
|
||||
BeginAggregation();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@@ -442,7 +442,7 @@ public partial class ObservableCollection<TItem> :
|
||||
collection.Insert(index, item);
|
||||
}
|
||||
|
||||
protected virtual IAggerate OnAggerate(object? key) =>
|
||||
protected virtual IAggerate OnPrepareAggregation(object? key) =>
|
||||
new AggerateEventArgs<TItem>() with { Key = key };
|
||||
|
||||
protected virtual void RemoveItem(int index) =>
|
||||
|
||||
Reference in New Issue
Block a user