2025-01-21 19:36:16 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Avalonia.Controls;
|
2025-01-21 18:51:45 +08:00
|
|
|
|
using Semi.Avalonia.Demo.ViewModels;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Semi.Avalonia.Demo.Pages;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class VariablesDemo : UserControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public VariablesDemo()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.DataContext = new VariablesDemoViewModel();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-21 19:36:16 +08:00
|
|
|
|
public async Task Copy(object? o)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (o is null) return;
|
|
|
|
|
|
var toplevel = TopLevel.GetTopLevel(this);
|
|
|
|
|
|
if (toplevel?.Clipboard is { } c)
|
|
|
|
|
|
{
|
|
|
|
|
|
await c.SetTextAsync(o.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-01-21 18:51:45 +08:00
|
|
|
|
}
|