using Avalonia.Controls; using LehrerApp.Core.Models; using LehrerApp.Desktop.ViewModels; using LehrerApp.Desktop.Views.Workload; namespace LehrerApp.Desktop.Views.Dashboard; public partial class DashboardView : UserControl { public DashboardView() => InitializeComponent(); protected override void OnDataContextChanged(EventArgs e) { base.OnDataContextChanged(e); if (DataContext is DashboardViewModel vm) vm.OnAddTask = ShowAddTaskDialog; } private async Task ShowAddTaskDialog(bool startAsReminder) { var owner = TopLevel.GetTopLevel(this) as Window; if (owner is null) return null; return await WorkTaskDialogHelper.ShowDialog(owner, startAsReminder: startAsReminder); } }