Schreibgeschützter LessonViewerDialog (größere Schrift, ohne Bearbeitungs-/Verlängern-/ Verschieben-Funktion) für den Einsatz während des Unterrichtens, erreichbar über "Anzeigen" im Stunden-Toolbar. Alternative Unterrichtsabläufe (z.B. Kurzversion bei Zeitmangel) laufen jetzt über einen echten Katalog (neues Modell AlternativeLessonPath: Name + Beschreibung) statt Freitext direkt an der Phase: im Verlaufsplan-Editor eine kompakte, farbig unterstützte Checkbox statt einer durchgehend sichtbaren Eingabespalte, Zuordnung/Neuanlage über einen eigenen Dialog. Der Viewer gruppiert Phasen entsprechend und zeigt die hinterlegte Beschreibung. Schema-Migration v3→v4 führt bestehende Freitextwerte verlustfrei in Katalogeinträge über. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using LehrerApp.Core.Interfaces;
|
|
using LehrerApp.Core.Models;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop.Views.Groups;
|
|
|
|
public partial class LessonDialog : Window
|
|
{
|
|
public LessonDialog() => InitializeComponent();
|
|
|
|
protected override void OnDataContextChanged(EventArgs e)
|
|
{
|
|
base.OnDataContextChanged(e);
|
|
if (DataContext is LessonDialogViewModel vm)
|
|
vm.OnPickAlternativePath = ShowAlternativePathDialog;
|
|
}
|
|
|
|
private async Task<AlternativeLessonPath?> ShowAlternativePathDialog(Guid? currentId)
|
|
{
|
|
var dialogVm = new AlternativePathDialogViewModel(
|
|
App.Services.GetRequiredService<IAlternativeLessonPathRepository>(), currentId);
|
|
var dialog = new AlternativePathDialog { DataContext = dialogVm };
|
|
|
|
var ok = await dialog.ShowDialog<bool>(this);
|
|
return ok ? dialogVm.Result : null;
|
|
}
|
|
|
|
private void OnSave(object? s, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is LessonDialogViewModel vm && vm.SaveCommand.CanExecute(null))
|
|
{
|
|
vm.SaveCommand.Execute(null);
|
|
if (vm.Result is not null) Close(true);
|
|
}
|
|
}
|
|
|
|
private void OnCancel(object? s, RoutedEventArgs e) => Close(false);
|
|
}
|