Add shared export infrastructure
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using LehrerApp.Desktop.Services;
|
||||
using LehrerApp.Desktop.ViewModels.Workload;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Workload;
|
||||
|
||||
public partial class WorkloadEvaluationView : UserControl
|
||||
{
|
||||
public WorkloadEvaluationView() => InitializeComponent();
|
||||
|
||||
private async void OnExportClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not WorkloadEvaluationViewModel vm) return;
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
if (topLevel is null) return;
|
||||
|
||||
var export = ExportFile.Csv("Arbeitszeitauswertung exportieren",
|
||||
vm.ExportSuggestedFileName, vm.ExportCsv());
|
||||
await App.Services.GetRequiredService<ExportService>().SaveAsync(topLevel.StorageProvider, export);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user