1e21e33ade
Move SecureStoreManager project and tests to Deprecated folder and remove from solution. SecureStore functionality is now integrated into ConfigManager.
34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using Avalonia.Input.Platform;
|
|
|
|
namespace JdeScoping.SecureStoreManager.Services;
|
|
|
|
/// <summary>
|
|
/// Avalonia implementation of IClipboardService.
|
|
/// </summary>
|
|
public class AvaloniaClipboardService : IClipboardService
|
|
{
|
|
private readonly Func<IClipboard?> _getClipboard;
|
|
|
|
/// <summary>
|
|
/// Creates a new instance of AvaloniaClipboardService.
|
|
/// </summary>
|
|
/// <param name="getClipboard">Factory function to get the clipboard instance.</param>
|
|
public AvaloniaClipboardService(Func<IClipboard?> getClipboard)
|
|
{
|
|
_getClipboard = getClipboard ?? throw new ArgumentNullException(nameof(getClipboard));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the clipboard text asynchronously.
|
|
/// </summary>
|
|
/// <param name="text">The text to set on the clipboard.</param>
|
|
public async Task SetTextAsync(string text)
|
|
{
|
|
var clipboard = _getClipboard();
|
|
if (clipboard != null)
|
|
{
|
|
await clipboard.SetTextAsync(text);
|
|
}
|
|
}
|
|
}
|