Use Value, not sender!!!!!!!!!!!!!!!!!!!!
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Activate
|
||||
{
|
||||
public static ActivateEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static ActivateEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static ActivateEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static ActivateEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ActivateEventArgs<TSender>
|
||||
public record ActivateEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ActivateEventArgs(TSender sender)
|
||||
public ActivateEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ActivateEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Activated
|
||||
{
|
||||
public static ActivatedEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static ActivatedEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static ActivatedEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static ActivatedEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ActivatedEventArgs<TSender>
|
||||
public record ActivatedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ActivatedEventArgs(TSender sender)
|
||||
public ActivatedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ActivatedEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Cancel
|
||||
{
|
||||
public static CancelEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static CancelEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static CancelEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static CancelEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record CancelEventArgs<TSender>
|
||||
public record CancelEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public CancelEventArgs(TSender sender)
|
||||
public CancelEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public CancelEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Changed
|
||||
{
|
||||
public static ChangedEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static ChangedEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static ChangedEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static ChangedEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ChangedEventArgs<TSender>
|
||||
public record ChangedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ChangedEventArgs(TSender sender)
|
||||
public ChangedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ChangedEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Close
|
||||
{
|
||||
public static CloseEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static CloseEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static CloseEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static CloseEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record CloseEventArgs<TSender>
|
||||
public record CloseEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public CloseEventArgs(TSender sender)
|
||||
public CloseEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public CloseEventArgs()
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
public record Closed
|
||||
{
|
||||
public static ClosedEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static ClosedEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static ClosedEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static ClosedEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ClosedEventArgs<TSender>
|
||||
public record ClosedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ClosedEventArgs(TSender sender)
|
||||
public ClosedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ClosedEventArgs()
|
||||
|
||||
@@ -7,7 +7,7 @@ public class ConfigurationChangedHandler<TConfiguration, TValue>(ConfigurationVa
|
||||
{
|
||||
public void Handle(ChangedEventArgs<TConfiguration> args)
|
||||
{
|
||||
if (args.Sender is TConfiguration configuration)
|
||||
if (args.Value is TConfiguration configuration)
|
||||
{
|
||||
if (configurationValue.TryUpdate(configuration, out TValue value))
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ConfirmEventArgs<TSender>
|
||||
public record ConfirmEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ConfirmEventArgs(TSender sender)
|
||||
public ConfirmEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ConfirmEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Count
|
||||
{
|
||||
public static CountEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static CountEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static CountEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static CountEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record CountEventArgs<TSender>
|
||||
public record CountEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public CountEventArgs(TSender sender)
|
||||
public CountEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public CountEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Create
|
||||
{
|
||||
public static CreateEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static CreateEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static CreateEventArgs<TSender> As<TSender>(params object[] parameters) where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static CreateEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record CreateEventArgs<TSender>
|
||||
public record CreateEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public CreateEventArgs(TSender sender)
|
||||
public CreateEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public CreateEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Created
|
||||
{
|
||||
public static CreatedEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static CreatedEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static CreatedEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static CreatedEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record CreatedEventArgs<TSender>(TSender? Sender = default);
|
||||
public record CreatedEventArgs<TValue>(TValue? Value = default);
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Deactivate
|
||||
{
|
||||
public static DeactivateEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static DeactivateEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static DeactivateEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static DeactivateEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record DeactivateEventArgs<TSender>
|
||||
public record DeactivateEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public DeactivateEventArgs(TSender sender)
|
||||
public DeactivateEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public DeactivateEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Deactivated
|
||||
{
|
||||
public static DeactivatedEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static DeactivatedEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static DeactivatedEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static DeactivatedEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record DeactivatedEventArgs<TSender>
|
||||
public record DeactivatedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public DeactivatedEventArgs(TSender sender)
|
||||
public DeactivatedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public DeactivatedEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Delete
|
||||
{
|
||||
public static DeleteEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static DeleteEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static DeleteEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static DeleteEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record DeleteEventArgs<TSender>
|
||||
public record DeleteEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public DeleteEventArgs(TSender sender)
|
||||
public DeleteEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public DeleteEventArgs()
|
||||
|
||||
@@ -157,6 +157,7 @@ public static class IServiceCollectionExtensions
|
||||
|
||||
public static IServiceCollection AddInitialization(this IServiceCollection services,
|
||||
Action<IServiceProvider> delegateAction)
|
||||
|
||||
{
|
||||
services.AddTransient<IInitialization>(provider => new ActionableInitialization(provider, delegateAction));
|
||||
return services;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Insert
|
||||
{
|
||||
public static InsertEventArgs<TSender> As<TSender>(int index, TSender sender) =>
|
||||
new(index, sender);
|
||||
public static InsertEventArgs<TValue> As<TValue>(int index, TValue value) =>
|
||||
new(index, value);
|
||||
|
||||
public static InsertEventArgs<TSender> As<TSender>(int index) where TSender : new() =>
|
||||
new(index, new TSender());
|
||||
public static InsertEventArgs<TValue> As<TValue>(int index) where TValue : new() =>
|
||||
new(index, new TValue());
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record InsertEventArgs<TSender>(int Index, TSender Sender);
|
||||
public record InsertEventArgs<TValue>(int Index, TValue Value);
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Move
|
||||
{
|
||||
public static MoveEventArgs<TSender> As<TSender>(int index, TSender sender) => new(index, sender);
|
||||
public static MoveEventArgs<TValue> As<TValue>(int index, TValue value) => new(index, value);
|
||||
|
||||
public static MoveEventArgs<TSender> As<TSender>(int index) where TSender : new() => new(index, new TSender());
|
||||
public static MoveEventArgs<TValue> As<TValue>(int index) where TValue : new() => new(index, new TValue());
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record MoveEventArgs<TSender>(int Index, TSender? Sender = default);
|
||||
public record MoveEventArgs<TValue>(int Index, TValue? Value = default);
|
||||
@@ -1,18 +1,18 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record MoveToEventArgs<TSender>
|
||||
public record MoveToEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public int OldIndex { get; }
|
||||
|
||||
public int NewIndex { get; }
|
||||
|
||||
public MoveToEventArgs(TSender sender,
|
||||
public MoveToEventArgs(TValue value,
|
||||
int oldIndex,
|
||||
int newIndex)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
OldIndex = oldIndex;
|
||||
NewIndex = newIndex;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public class Notify
|
||||
{
|
||||
public static NotifyEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static NotifyEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static NotifyEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static NotifyEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record NotifyEventArgs<TSender>
|
||||
public record NotifyEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public NotifyEventArgs(TSender sender)
|
||||
public NotifyEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public NotifyEventArgs()
|
||||
|
||||
@@ -313,7 +313,7 @@ public abstract partial class ObservableCollection<TViewModel> :
|
||||
{
|
||||
foreach (TViewModel item in this.ToList())
|
||||
{
|
||||
if (args.Sender is not null && args.Sender.Equals(item))
|
||||
if (args.Value is not null && args.Value.Equals(item))
|
||||
{
|
||||
Remove(item);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public abstract partial class ObservableCollection<TViewModel> :
|
||||
|
||||
public void Receive(CreateEventArgs<TViewModel> args)
|
||||
{
|
||||
if (args.Sender is TViewModel item)
|
||||
if (args.Value is TViewModel item)
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public abstract partial class ObservableCollection<TViewModel> :
|
||||
|
||||
public void Receive(InsertEventArgs<TViewModel> args)
|
||||
{
|
||||
if (args.Sender is TViewModel item)
|
||||
if (args.Value is TViewModel item)
|
||||
{
|
||||
Insert(args.Index, item);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ public abstract partial class ObservableCollection<TViewModel> :
|
||||
|
||||
public void Receive(MoveEventArgs<TViewModel> args)
|
||||
{
|
||||
if (args.Sender is TViewModel item)
|
||||
if (args.Value is TViewModel item)
|
||||
{
|
||||
Move(args.Index, item);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public abstract partial class ObservableCollection<TViewModel> :
|
||||
|
||||
public void Receive(ReplaceEventArgs<TViewModel> args)
|
||||
{
|
||||
if (args.Sender is TViewModel item)
|
||||
if (args.Value is TViewModel item)
|
||||
{
|
||||
Replace(args.Index, item);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public partial class ObservableConfiguration<TConfiguration, TValue> :
|
||||
|
||||
public void Receive(ChangedEventArgs<TConfiguration> args)
|
||||
{
|
||||
if (args.Sender is TConfiguration configuration)
|
||||
if (args.Value is TConfiguration configuration)
|
||||
{
|
||||
dispatcher.Invoke(() => Value = read(configuration));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public partial class ObservableConfigurationCollection<TConfiguration, TValue, T
|
||||
|
||||
public void Receive(ChangedEventArgs<TConfiguration> args)
|
||||
{
|
||||
if (args.Sender is TConfiguration configuration)
|
||||
if (args.Value is TConfiguration configuration)
|
||||
{
|
||||
dispatcher.Invoke(() => Value = read(configuration));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Open
|
||||
{
|
||||
public static OpenEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static OpenEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static OpenEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static OpenEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record OpenEventArgs<TSender>
|
||||
public record OpenEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public OpenEventArgs(TSender sender)
|
||||
public OpenEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public OpenEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Opened
|
||||
{
|
||||
public static OpenedEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static OpenedEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static OpenedEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static OpenedEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record OpenedEventArgs<TSender>
|
||||
public record OpenedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public OpenedEventArgs(TSender sender)
|
||||
public OpenedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public OpenedEventArgs()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record QueryEventArgs<TSender>
|
||||
public record QueryEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public QueryEventArgs(TSender sender)
|
||||
public QueryEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public QueryEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public class Read
|
||||
{
|
||||
public static ReadEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static ReadEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static ReadEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static ReadEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ReadEventArgs<TSender>
|
||||
public record ReadEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ReadEventArgs(TSender sender)
|
||||
public ReadEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ReadEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Remove
|
||||
{
|
||||
public static RemoveEventArgs<TSender> As<TSender>(TSender sender) => new(sender);
|
||||
public static RemoveEventArgs<TValue> As<TValue>(TValue value) => new(value);
|
||||
|
||||
public static RemoveEventArgs<TSender> As<TSender>() where TSender : new() => new(new TSender());
|
||||
public static RemoveEventArgs<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
public record RemoveAt
|
||||
{
|
||||
public static RemoveAtEventArgs<TSender> As<TSender>(int index) =>
|
||||
public static RemoveAtEventArgs<TValue> As<TValue>(int index) =>
|
||||
new(index);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record RemoveAtEventArgs<TSender>
|
||||
public record RemoveAtEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public int Index { get; }
|
||||
|
||||
public RemoveAtEventArgs(TSender sender,
|
||||
public RemoveAtEventArgs(TValue value,
|
||||
int index)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
Index = index;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record RemoveEventArgs<TSender>
|
||||
public record RemoveEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public RemoveEventArgs(TSender sender)
|
||||
public RemoveEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public RemoveEventArgs()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public record Replace
|
||||
{
|
||||
public static ReplaceEventArgs<TSender> As<TSender>(int index, TSender sender) => new(sender, index);
|
||||
public static ReplaceEventArgs<TValue> As<TValue>(int index, TValue value) => new(value, index);
|
||||
|
||||
public static ReplaceEventArgs<TSender> As<TSender>(int index) where TSender : new() => new(index);
|
||||
public static ReplaceEventArgs<TValue> As<TValue>(int index) where TValue : new() => new(index);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ReplaceEventArgs<TSender>
|
||||
public record ReplaceEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public int Index { get; }
|
||||
|
||||
public ReplaceEventArgs(TSender sender,
|
||||
public ReplaceEventArgs(TValue value,
|
||||
int index)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
Index = index;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public class Request
|
||||
{
|
||||
public static RequestEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static RequestEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static RequestEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static RequestEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
public record RequestEventArgs
|
||||
{
|
||||
public object? Sender { get; init; }
|
||||
public object? Value { get; init; }
|
||||
|
||||
public RequestEventArgs(object? sender = null)
|
||||
public RequestEventArgs(object? value = null)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public record RequestEventArgs<TSender> : RequestEventArgs
|
||||
public record RequestEventArgs<TValue> : RequestEventArgs
|
||||
{
|
||||
public RequestEventArgs(TSender sender) : base(sender)
|
||||
public RequestEventArgs(TValue value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ public class SelectFilesHandler(IFileProvider fileProvider) :
|
||||
public async Task<IReadOnlyCollection<string>?> Handle(SelectionEventArgs<FileFilter> args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (args.Sender is FileFilter filter)
|
||||
if (args.Value is FileFilter filter)
|
||||
{
|
||||
if (await fileProvider.SelectFiles(filter)
|
||||
is { Count: > 0 } files)
|
||||
|
||||
@@ -7,7 +7,7 @@ public class SelectFoldersHandler(IFolderProvider folderProvider) :
|
||||
public async Task<IReadOnlyCollection<string>?> Handle(SelectionEventArgs<FolderFilter> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (args.Sender is FolderFilter filter)
|
||||
if (args.Value is FolderFilter filter)
|
||||
{
|
||||
if (await folderProvider.SelectFolders(filter)
|
||||
is { Count: > 0 } folders)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Selection
|
||||
{
|
||||
public static SelectionEventArgs<TSender?> As<TSender>(TSender? sender) =>
|
||||
new(sender);
|
||||
public static SelectionEventArgs<TValue?> As<TValue>(TValue? value) =>
|
||||
new(value);
|
||||
|
||||
public static SelectionEventArgs<TSender?> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static SelectionEventArgs<TValue?> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record SelectionEventArgs<TSender>
|
||||
public record SelectionEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public SelectionEventArgs(TSender sender)
|
||||
public SelectionEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public SelectionEventArgs()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record UpdateEventArgs<TSender>
|
||||
public record UpdateEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public UpdateEventArgs(TSender sender)
|
||||
public UpdateEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public UpdateEventArgs()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record UpdatedEventArgs<TSender>
|
||||
public record UpdatedEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public UpdatedEventArgs(TSender sender)
|
||||
public UpdatedEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public UpdatedEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public record Validate
|
||||
{
|
||||
public static ValidateEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static ValidateEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static ValidateEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static ValidateEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record ValidateEventArgs<TSender>
|
||||
public record ValidateEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public ValidateEventArgs(TSender sender)
|
||||
public ValidateEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public ValidateEventArgs()
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
public class Write
|
||||
{
|
||||
public static WriteEventArgs<TSender> As<TSender>(TSender sender) =>
|
||||
new(sender);
|
||||
public static WriteEventArgs<TValue> As<TValue>(TValue value) =>
|
||||
new(value);
|
||||
|
||||
public static WriteEventArgs<TSender> As<TSender>() where TSender : new() =>
|
||||
new(new TSender());
|
||||
public static WriteEventArgs<TValue> As<TValue>() where TValue : new() =>
|
||||
new(new TValue());
|
||||
}
|
||||
@@ -6,7 +6,7 @@ public class WriteClipboardHandler(IClipboardWriter clipboardWriter) :
|
||||
public async Task Handle(WriteEventArgs<Clipboard<object>> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (args.Sender is Clipboard<object> clipboard)
|
||||
if (args.Value is Clipboard<object> clipboard)
|
||||
{
|
||||
await clipboardWriter.Write(clipboard.Value);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record WriteEventArgs<TSender>
|
||||
public record WriteEventArgs<TValue>
|
||||
{
|
||||
public TSender? Sender { get; }
|
||||
public TValue? Value { get; }
|
||||
|
||||
public WriteEventArgs(TSender sender)
|
||||
public WriteEventArgs(TValue value)
|
||||
{
|
||||
Sender = sender;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public WriteEventArgs()
|
||||
|
||||
Reference in New Issue
Block a user