Files
LehrerApp/LehrerApp.Desktop/Views/Students/WebUntisDocumentationComparisonDialog.axaml.cs

25 lines
933 B
C#

using Avalonia.Controls;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using LehrerApp.Desktop.Services;
using LehrerApp.Desktop.ViewModels.Students;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views.Students;
public partial class WebUntisDocumentationComparisonDialog : Window
{
public WebUntisDocumentationComparisonDialog() => InitializeComponent();
private void OnClose(object? sender, RoutedEventArgs e) => Close();
private async void OnCopyToClipboardClick(object? sender, RoutedEventArgs e)
{
if (sender is not Button { DataContext: LocalOnlyDocumentationRow row }) return;
var clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
if (clipboard is null) return;
await clipboard.SetTextAsync(row.ClipboardText);
App.Services.GetRequiredService<NotificationService>().ShowSuccess("In die Zwischenablage kopiert.");
}
}