Paste from clipboard WIP
This commit is contained in:
@@ -74,6 +74,7 @@ public static class MainConfiguration
|
||||
new(PasteCommand.PasteMergeCommandName, new[] {Key.P, Key.P}),
|
||||
new(PasteCommand.PasteOverwriteCommandName, new[] {Key.P, Key.O}),
|
||||
new(PasteCommand.PasteSkipCommandName, new[] {Key.P, Key.S}),
|
||||
new(PasteFilesFromClipboardCommand.PasteMergeCommandName, new[] {Key.C, Key.X}),
|
||||
//new CommandBindingConfiguration(ConfigCommand.PinFavorite, new[] { Key.F, Key.P }),
|
||||
//new CommandBindingConfiguration(ConfigCommand.PreviousTimelineBlock, Key.H ),
|
||||
//new CommandBindingConfiguration(ConfigCommand.PreviousTimelineCommand, Key.K ),
|
||||
|
||||
@@ -9,9 +9,26 @@ public class SystemClipboardService : ISystemClipboardService
|
||||
public async Task CopyToClipboardAsync(string text)
|
||||
{
|
||||
var clipboard = AvaloniaLocator.Current.GetService<IClipboard>();
|
||||
if (clipboard is not null)
|
||||
{
|
||||
await clipboard.SetTextAsync(text);
|
||||
}
|
||||
|
||||
if (clipboard is null) { return; }
|
||||
|
||||
await clipboard.SetTextAsync(text);
|
||||
}
|
||||
public async Task GetFiles()
|
||||
{
|
||||
var clipboard = AvaloniaLocator.Current.GetService<IClipboard>();
|
||||
|
||||
if (clipboard is null) { return; }
|
||||
|
||||
await clipboard.ClearAsync();
|
||||
|
||||
var formats = await clipboard.GetFormatsAsync();
|
||||
if (!formats.Contains("asd")) return;
|
||||
var obj = (await clipboard.GetDataAsync("PNG"));
|
||||
/*var ms = new MemoryStream();
|
||||
Serializer.Serialize(ms, obj);
|
||||
byte[] data = ms.ToArray().Skip(4).ToArray();
|
||||
ms = new MemoryStream(data);*/
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user