2 changed files with 33 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Avalonia.Input.Platform; |
|||
using MonoMac.AppKit; |
|||
|
|||
namespace Avalonia.MonoMac |
|||
{ |
|||
class ClipboardImpl : IClipboard |
|||
{ |
|||
public Task<string> GetTextAsync() |
|||
{ |
|||
return Task.FromResult(NSPasteboard.GeneralPasteboard.GetStringForType(NSPasteboard.NSStringType)); |
|||
} |
|||
|
|||
public Task SetTextAsync(string text) |
|||
{ |
|||
NSPasteboard.GeneralPasteboard.ClearContents(); |
|||
if (text != null) |
|||
NSPasteboard.GeneralPasteboard.SetStringForType(text, NSPasteboard.NSStringType); |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public async Task ClearAsync() |
|||
{ |
|||
NSPasteboard.GeneralPasteboard.ClearContents(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue