Tweaks
This commit is contained in:
@@ -138,6 +138,8 @@ public static class IServiceCollectionExtensions
|
||||
services.AddTransient<IContentTemplate, ContentTemplate>();
|
||||
services.AddTransient<INavigationRegion, NavigationRegion>();
|
||||
|
||||
services.AddHandler<WriteClipboardHandler>();
|
||||
|
||||
services.AddHandler<ClassicDesktopStyleApplicationHandler>(nameof(IClassicDesktopStyleApplicationLifetime));
|
||||
services.AddHandler<SingleViewApplicationHandler>(nameof(ISingleViewApplicationLifetime));
|
||||
services.AddHandler<ContentControlHandler>(nameof(ContentControl));
|
||||
@@ -167,6 +169,8 @@ public static class IServiceCollectionExtensions
|
||||
|
||||
services.AddTransient<INavigationRegion, NavigationRegion>();
|
||||
|
||||
services.AddHandler<WriteClipboardHandler>();
|
||||
|
||||
services.AddHandler<ContentControlHandler>(nameof(ContentControl));
|
||||
services.AddHandler<FrameHandler>(nameof(Frame));
|
||||
services.AddHandler<ContentDialogHandler>(nameof(ContentDialog));
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public record Clipboard;
|
||||
|
||||
public record Clipboard<TValue>(TValue Value);
|
||||
@@ -4,5 +4,5 @@ public record Move
|
||||
{
|
||||
public static MoveEventArgs<TSender> As<TSender>(int index, TSender sender) => new(index, sender);
|
||||
|
||||
public static InsertEventArgs<TSender> As<TSender>(int index) where TSender : new() => new(index, new TSender());
|
||||
public static MoveEventArgs<TSender> As<TSender>(int index) where TSender : new() => new(index, new TSender());
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public class WriteClipboardHandler(IClipboardWriter clipboardWriter) :
|
||||
INotificationHandler<WriteEventArgs<Clipboard<object>>>
|
||||
{
|
||||
public async Task Handle(WriteEventArgs<Clipboard<object>> args)
|
||||
{
|
||||
if (args.Sender is Clipboard<object> clipboard)
|
||||
{
|
||||
await clipboardWriter.Write(clipboard.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user