Zwei neue Buttons ("Mitarbeit", "Anwesenheit/Hausaufgabe") öffnen die
bestehenden Schnellbewertungs-Dialoge direkt aus dem Unterrichtsmodus, ohne
zum Mitarbeit-Tab wechseln zu müssen — TeachingModeViewModel bekommt dafür
eine eigene ParticipationTabViewModel-Instanz, vorselektiert auf die zu
dieser Stunde gehörende Sitzung. Die linke Spalte zeigt jetzt zusätzlich die
Hausaufgabe der letzten Stunde mit Kontrolliert-Checkbox sowie die
Hausaufgabe dieser Stunde als editierbares Feld, statt nur lesbar.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
55 lines
2.5 KiB
C#
55 lines
2.5 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using LehrerApp.Desktop.ViewModels;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop.Views.Groups;
|
|
|
|
public partial class TeachingModeWindow : Window
|
|
{
|
|
public TeachingModeWindow() => InitializeComponent();
|
|
|
|
protected override void OnDataContextChanged(EventArgs e)
|
|
{
|
|
base.OnDataContextChanged(e);
|
|
// Gleiches Muster wie LessonViewerDialog (4.5.3): Fenster schließt zuerst, dann Sprung
|
|
// über die MainWindowViewModel-Singleton-Navigation in den Ziel-Tab der Gruppe.
|
|
if (DataContext is TeachingModeViewModel vm)
|
|
{
|
|
vm.LessonInfo.OnNavigateToTab = tabIndex =>
|
|
{
|
|
Close();
|
|
App.Services.GetRequiredService<MainWindowViewModel>()
|
|
.NavigateToGroupDetail(vm.LessonInfo.GroupId, tabIndex);
|
|
};
|
|
// Nutzer-Feedback: Schnellbewertung (Mitarbeit) und Schnellanwesenheit/Hausaufgabe
|
|
// direkt aus dem Unterrichtsmodus statt erst zum Mitarbeit-Tab wechseln zu müssen —
|
|
// dieselben Dialoge wie in ParticipationTabView.axaml.cs, hier auf die zu dieser
|
|
// Stunde gehörende Sitzung vorselektiert (siehe TeachingModeViewModel-Konstruktor).
|
|
vm.Participation.OnQuickInput = ShowQuickInputDialog;
|
|
vm.Participation.OnStatusQuickInput = ShowStatusQuickInputDialog;
|
|
}
|
|
}
|
|
|
|
private async Task ShowQuickInputDialog(ParticipationTabViewModel tabVm)
|
|
{
|
|
if (tabVm.StudentRows.Count == 0) return;
|
|
var quickVm = new QuickInputViewModel(tabVm.StudentRows.ToList(), tabVm.Aspects.ToList());
|
|
var dialog = new ParticipationQuickInputDialog { DataContext = quickVm };
|
|
await dialog.ShowDialog(this);
|
|
(DataContext as TeachingModeViewModel)?.SeatingPlan.ReloadSeatBadgesFromRepository();
|
|
}
|
|
|
|
private async Task ShowStatusQuickInputDialog(ParticipationTabViewModel tabVm)
|
|
{
|
|
if (tabVm.StudentRows.Count == 0 || tabVm.SelectedSession is null) return;
|
|
var quickVm = new AttendanceHomeworkQuickInputViewModel(tabVm.StudentRows, tabVm.SelectedSessionDisplay);
|
|
var dialog = new AttendanceHomeworkQuickInputDialog { DataContext = quickVm };
|
|
await dialog.ShowDialog(this);
|
|
(DataContext as TeachingModeViewModel)?.SeatingPlan.ReloadSeatBadgesFromRepository();
|
|
}
|
|
|
|
private void OnClose(object? sender, RoutedEventArgs e) => Close();
|
|
}
|