feat: expand teaching mode with live timeline and seating quick checks
CI / build-and-test (push) Canceled after 0s
CI / build-and-test (push) Canceled after 0s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:models="clr-namespace:LehrerApp.Core.Models;assembly=LehrerApp.Core"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
xmlns:vmRoot="clr-namespace:LehrerApp.Desktop.ViewModels"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.GroupOverviewTabView"
|
||||
@@ -42,6 +43,19 @@
|
||||
<StackPanel Spacing="0">
|
||||
<WrapPanel>
|
||||
|
||||
<Border Classes="card" IsVisible="{Binding HasTodayLessons}">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="UNTERRICHT HEUTE" Classes="cardTitle"/>
|
||||
<ComboBox ItemsSource="{Binding TodayLessons}" SelectedItem="{Binding SelectedTeachingLesson}" HorizontalAlignment="Stretch">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="models:Lesson">
|
||||
<TextBlock><Run Text="{Binding StartTime}"/><Run Text=" · "/><Run Text="{Binding Topic}"/></TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Content="Unterrichtsansicht öffnen" Command="{Binding StartTeachingModeCommand}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Nächste Stunde -->
|
||||
<Border Classes="card">
|
||||
<StackPanel>
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
using Avalonia.Controls;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
|
||||
public partial class GroupOverviewTabView : UserControl
|
||||
{
|
||||
public GroupOverviewTabView() => InitializeComponent();
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
if (DataContext is GroupOverviewViewModel vm) vm.OnOpenTeachingMode = TeachingModeWindow.Open;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<Grid ColumnDefinitions="260,*">
|
||||
<Border Grid.Column="0" BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<Border Grid.Column="0" Width="260" IsVisible="{Binding !IsTeachingMode}" BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,1,0" Padding="16">
|
||||
<Grid RowDefinitions="Auto,*,Auto">
|
||||
<StackPanel Grid.Row="0" Spacing="4" Margin="0,0,0,12">
|
||||
@@ -72,26 +72,35 @@
|
||||
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*,Auto" IsVisible="{Binding HasSelectedPlan}" Margin="24">
|
||||
<Grid Grid.Row="0" Grid.ColumnSpan="2" ColumnDefinitions="*,Auto" Margin="0,0,0,18">
|
||||
<StackPanel Spacing="3">
|
||||
<TextBlock Text="{Binding PlanTitle}" FontSize="22" FontWeight="SemiBold"/>
|
||||
<ComboBox ItemsSource="{Binding Plans}" SelectedItem="{Binding SelectedPlan}" DisplayMemberBinding="{Binding Name}"
|
||||
IsVisible="{Binding IsTeachingMode}" MinWidth="180"/>
|
||||
<TextBlock Text="{Binding PlanTitle}" FontSize="22" FontWeight="SemiBold" IsVisible="{Binding !IsTeachingMode}"/>
|
||||
<TextBlock Text="{Binding PlanSubtitle}" Opacity="0.65"/>
|
||||
<TextBlock Text="{Binding QuickModeDisplay}" FontSize="12" TextWrapping="Wrap" IsVisible="{Binding IsTeachingMode}"/>
|
||||
<Border IsVisible="{Binding !IsTeachingMode}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,6,0,0"
|
||||
IsVisible="{Binding IsEditMode, Converter={x:Static BoolConverters.Not}}">
|
||||
<TextBlock Text="Unterricht:" VerticalAlignment="Center" FontSize="12" Opacity="0.65"/>
|
||||
<ComboBox ItemsSource="{Binding TodaySessions}" SelectedItem="{Binding SelectedSession}"
|
||||
DisplayMemberBinding="{Binding DisplayName}" MinWidth="210"/>
|
||||
DisplayMemberBinding="{Binding DisplayName}" MinWidth="210" IsEnabled="{Binding !IsTeachingMode}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Bottom" Spacing="4">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10" HorizontalAlignment="Right">
|
||||
<Button Content="Als PDF" Click="OnExportPdfClick" VerticalAlignment="Center"/>
|
||||
<ToggleSwitch Content="Bearbeitungsmodus" IsChecked="{Binding IsEditMode}"
|
||||
IsVisible="{Binding IsEditable}"/>
|
||||
<Border IsVisible="{Binding !IsTeachingMode}">
|
||||
<ToggleSwitch Content="Bearbeitungsmodus" IsChecked="{Binding IsEditMode}"
|
||||
IsVisible="{Binding IsEditable}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding AssignmentSummary}" HorizontalAlignment="Right" FontSize="12" Opacity="0.6"/>
|
||||
<TextBlock Text="Ziehen: Platz ändern · Klicken: bewerten" HorizontalAlignment="Right"
|
||||
FontSize="11" Opacity="0.5" IsVisible="{Binding IsEditMode}"/>
|
||||
<TextBlock Text="Klicken: bewerten" HorizontalAlignment="Right"
|
||||
FontSize="11" Opacity="0.5" IsVisible="{Binding IsEditMode, Converter={x:Static BoolConverters.Not}}"/>
|
||||
<Border IsVisible="{Binding !IsTeachingMode}">
|
||||
<TextBlock Text="{Binding QuickModeDisplay}" HorizontalAlignment="Right"
|
||||
FontSize="11" Opacity="0.5" IsVisible="{Binding IsEditMode, Converter={x:Static BoolConverters.Not}}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -158,10 +167,20 @@
|
||||
IsVisible="{Binding HasDayHighlightBadge}"
|
||||
ToolTip.Tip="Tagesflagge"/>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="4" IsVisible="{Binding ShowQuickCheck}">
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<Button Content="{Binding QuickPositiveLabel}" Command="{Binding QuickPositiveCommand}"
|
||||
FontSize="11" Padding="5,5" HorizontalAlignment="Stretch" Margin="0,0,3,0"/>
|
||||
<Button Grid.Column="1" Content="{Binding QuickNegativeLabel}" Command="{Binding QuickNegativeCommand}"
|
||||
FontSize="11" Padding="5,5" HorizontalAlignment="Stretch"/>
|
||||
</Grid>
|
||||
<Button Content="Sonderfälle …" Command="{Binding QuickSpecialCommand}"
|
||||
FontSize="10" Padding="5,3" HorizontalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
<!-- Strichliste Meldungen (Nutzer-Feedback): schnelles Mitzählen ohne den
|
||||
vollen Bewertungsdialog zu öffnen -->
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="5"
|
||||
IsVisible="{Binding ShowLessonOverview}">
|
||||
IsVisible="{Binding ShowNormalActions}">
|
||||
<Button Padding="6,2" FontSize="10"
|
||||
Command="{Binding TallyRaisedHandCommand}"
|
||||
ToolTip.Tip="Meldung zählen">
|
||||
@@ -174,7 +193,7 @@
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<Expander Header="+ Situation" FontSize="10"
|
||||
IsVisible="{Binding CanRecordLesson}">
|
||||
IsVisible="{Binding ShowSituationActions}">
|
||||
<ItemsControl ItemsSource="{Binding SituationTags}" Margin="0,4,0,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate><WrapPanel ItemSpacing="3" LineSpacing="3"/></ItemsPanelTemplate>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:models="clr-namespace:LehrerApp.Core.Models;assembly=LehrerApp.Core"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
xmlns:views="clr-namespace:LehrerApp.Desktop.Views.Groups"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.TeachingModeWindow"
|
||||
@@ -8,8 +9,23 @@
|
||||
Width="1400" Height="850" MinWidth="1000" MinHeight="600"
|
||||
WindowState="Maximized" CanResize="True" WindowStartupLocation="CenterScreen">
|
||||
|
||||
<Window.Styles>
|
||||
<Style Selector="Border.phase">
|
||||
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundAltHighBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="2"/>
|
||||
</Style>
|
||||
<Style Selector="Border.phase.overflow">
|
||||
<Setter Property="Background" Value="#22E57373"/>
|
||||
<Setter Property="BorderBrush" Value="#99E57373"/>
|
||||
</Style>
|
||||
<Style Selector="Border.phase.active">
|
||||
<Setter Property="Background" Value="#223BA6C8"/>
|
||||
<Setter Property="BorderBrush" Value="#3BA6C8"/>
|
||||
</Style>
|
||||
</Window.Styles>
|
||||
<Grid RowDefinitions="Auto,*" Margin="20">
|
||||
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,0,0,14">
|
||||
<Grid Grid.Row="0" RowDefinitions="Auto,Auto" Margin="0,0,0,14">
|
||||
<StackPanel Grid.Column="0" Spacing="3">
|
||||
<TextBlock FontSize="20" FontWeight="SemiBold">
|
||||
<Run Text="{Binding GroupName}"/><Run Text=" · "/><Run Text="{Binding LessonInfo.Topic}"/>
|
||||
@@ -26,19 +42,22 @@
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
||||
<WrapPanel Grid.Row="1" ItemSpacing="8" LineSpacing="6" Margin="0,10,0,0">
|
||||
<!-- Nutzer-Feedback: die Schnellbewertungs-Dialoge gab es bisher nur über den
|
||||
Mitarbeit-Tab der Gruppe — hier direkt auf die Sitzung dieser Stunde vorselektiert
|
||||
(siehe TeachingModeViewModel), kein Umweg mehr über "Zur Mitarbeit". -->
|
||||
<Button Content="⚡ Mitarbeit" Command="{Binding Participation.QuickInputCommand}"
|
||||
ToolTip.Tip="Mitarbeit dieser Stunde schnell bewerten."/>
|
||||
<Button Content="⚡ Anwesenheit/Hausaufgabe" Command="{Binding Participation.StatusQuickInputCommand}"
|
||||
ToolTip.Tip="Anwesenheit und Hausaufgabenstatus dieser Stunde schnell erfassen."/>
|
||||
<Button Content="Anwesenheit kontrollieren" Command="{Binding SeatingPlan.CheckAttendanceCommand}" IsEnabled="{Binding SeatingPlan.IsEditable}"/>
|
||||
<Button Content="Hausaufgaben kontrollieren" Command="{Binding SeatingPlan.CheckHomeworkCommand}" IsEnabled="{Binding SeatingPlan.IsEditable}"/>
|
||||
<Button Content="Kontrolle beenden" Command="{Binding SeatingPlan.EndQuickCheckCommand}" IsVisible="{Binding SeatingPlan.IsQuickMode}"/>
|
||||
<Button Content="Listenansicht …" Command="{Binding Participation.StatusQuickInputCommand}" ToolTip.Tip="Auch Schüler ohne Sitzplatz erfassen."/>
|
||||
<Button Content="Vollbild ↔" Click="OnFullScreen" ToolTip.Tip="Vollbild umschalten (F11); mit Escape verlassen."/>
|
||||
<Button Content="Zur Mitarbeit" Command="{Binding LessonInfo.NavigateToParticipationCommand}"
|
||||
ToolTip.Tip="Schließt den Unterrichtsmodus und springt zum Tab 'Mitarbeit' der Lerngruppe."/>
|
||||
<Button Content="Zu den Noten" Command="{Binding LessonInfo.NavigateToGradesCommand}"/>
|
||||
<Button Content="Unterrichtsmodus beenden" Click="OnClose" Margin="16,0,0,0"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="360,16,*">
|
||||
@@ -48,44 +67,78 @@
|
||||
<StackPanel Spacing="14">
|
||||
<TextBlock Text="Verlaufsplan" FontSize="14" FontWeight="SemiBold"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding LessonInfo.PhaseGroups}">
|
||||
<TextBlock Text="Hauptweg · Live-Verlauf" FontSize="12" Opacity="0.65"/>
|
||||
<TextBlock Text="Noch keine Phasen geplant." IsVisible="{Binding !Timeline.HasPhases}"/>
|
||||
<Button Content="Zeitmessung jetzt starten" Command="{Binding Timeline.StartNowCommand}" IsVisible="{Binding Timeline.NeedsStart}" IsEnabled="{Binding Timeline.IsEditable}"/>
|
||||
<ItemsControl ItemsSource="{Binding Timeline.Phases}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:PhaseGroupViewItem">
|
||||
<StackPanel Margin="0,0,0,10">
|
||||
<StackPanel IsVisible="{Binding $parent[ItemsControl].((vm:LessonViewerViewModel)DataContext).HasAlternatives}">
|
||||
<TextBlock Text="{Binding Label}" FontSize="12" FontWeight="SemiBold" Opacity="0.75" Margin="0,6,0,2"/>
|
||||
<TextBlock Text="{Binding Description}" FontSize="11" Opacity="0.55" TextWrapping="Wrap" Margin="0,0,0,6"
|
||||
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<DataTemplate x:DataType="vm:TeachingPhaseViewModel">
|
||||
<Border Classes="phase" Classes.active="{Binding IsActive}" Classes.overflow="{Binding IsOverflow}" CornerRadius="6" Padding="10,8" Margin="0,0,0,8">
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock Text="{Binding Source.Name}" FontWeight="SemiBold" TextWrapping="Wrap"/>
|
||||
<TextBlock Text="{Binding TimeDisplay}" FontSize="12"/>
|
||||
<TextBlock Text="{Binding Source.DurationMinutes, StringFormat='Geplant: {0} Min.'}" FontSize="11" Opacity="0.7"/>
|
||||
<TextBlock Text="{Binding Source.Activity}" TextWrapping="Wrap" FontSize="12"
|
||||
IsVisible="{Binding Source.Activity, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock Text="{Binding Source.Material}" TextWrapping="Wrap" FontSize="11" Opacity="0.7"
|
||||
IsVisible="{Binding Source.Material, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock Text="{Binding Source.Shorthand}" FontSize="11" Opacity="0.7"
|
||||
IsVisible="{Binding Source.Shorthand, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<ProgressBar Minimum="0" Maximum="100" Value="{Binding Progress}" Height="3" IsVisible="{Binding IsActive}"/>
|
||||
<TextBlock Text="Über dem geplanten Stundenende" FontSize="11" IsVisible="{Binding IsOverflow}"/>
|
||||
<TextBlock Text="Erledigt" FontSize="11" Opacity="0.6" IsVisible="{Binding IsCompleted}"/>
|
||||
<TextBlock Text="In Folgestunde kopiert" FontSize="11" IsVisible="{Binding IsTransferred}"/>
|
||||
<StackPanel IsVisible="{Binding IsActive}" IsEnabled="{Binding IsEditable}" Spacing="4">
|
||||
<WrapPanel ItemSpacing="4" LineSpacing="4">
|
||||
<Button Content="Weiter" Command="{Binding FinishCommand}" FontSize="11" Padding="6,4"/>
|
||||
<Button Content="+5 Min." Command="{Binding ExtendFiveCommand}" FontSize="11" Padding="6,4"/>
|
||||
<Button Content="+10 Min." Command="{Binding ExtendTenCommand}" FontSize="11" Padding="6,4"/>
|
||||
<Button Content="Halten bis Weiter" Command="{Binding HoldCommand}" FontSize="11" Padding="6,4" IsEnabled="{Binding !IsHeld}"/>
|
||||
</WrapPanel>
|
||||
<TextBlock Text="Gehalten – mit Weiter nächste Phase starten" FontSize="11" TextWrapping="Wrap" IsVisible="{Binding IsHeld}"/>
|
||||
</StackPanel>
|
||||
<Button Content="Jetzt vorziehen" Command="{Binding BringForwardCommand}" IsVisible="{Binding CanStartNow}" FontSize="11"/>
|
||||
</StackPanel>
|
||||
<ItemsControl ItemsSource="{Binding Phases}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:PhaseViewItem">
|
||||
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
CornerRadius="6" Padding="10,8" Margin="0,0,0,6">
|
||||
<StackPanel Spacing="2">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" FontSize="13" FontWeight="SemiBold"
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock Grid.Column="1" FontSize="11" Opacity="0.6">
|
||||
<Run Text="{Binding TimeDisplay}"/><Run Text=" · "/>
|
||||
<Run Text="{Binding DurationMinutes, StringFormat='{}{0} Min.'}"/>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding Activity}" FontSize="12" TextWrapping="Wrap"
|
||||
IsVisible="{Binding Activity, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock FontSize="11" Opacity="0.55" TextWrapping="Wrap"
|
||||
IsVisible="{Binding Material, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
||||
<Run Text="Material: "/><Run Text="{Binding Material}"/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<StackPanel Spacing="6" IsVisible="{Binding Timeline.HasRemainder}" IsEnabled="{Binding Timeline.IsEditable}">
|
||||
<TextBlock Text="Rest für eine Folgestunde" FontWeight="SemiBold"/>
|
||||
<ComboBox ItemsSource="{Binding Timeline.TransferTargets}" SelectedItem="{Binding Timeline.TransferTarget}" HorizontalAlignment="Stretch">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="models:Lesson">
|
||||
<TextBlock><Run Text="{Binding Date, StringFormat='{}{0:dd.MM.yyyy}'}"/><Run Text=" · "/><Run Text="{Binding Topic}"/></TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Content="Rötlich markierte Phasen kopieren" Command="{Binding Timeline.TransferRemainderCommand}" IsEnabled="{Binding Timeline.HasTransferTargets}"/>
|
||||
<TextBlock Text="Zuerst eine Folgestunde in der Planung anlegen." IsVisible="{Binding !Timeline.HasTransferTargets}" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding Timeline.Status}" TextWrapping="Wrap" FontSize="11"/>
|
||||
<Expander Header="Alternative Abläufe" IsVisible="{Binding LessonInfo.HasAlternatives}">
|
||||
<ItemsControl ItemsSource="{Binding LessonInfo.PhaseGroups}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:PhaseGroupViewItem">
|
||||
<StackPanel IsVisible="{Binding !IsMainPath}" Spacing="4" Margin="0,4">
|
||||
<TextBlock Text="{Binding Label}" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding Description}" TextWrapping="Wrap"/>
|
||||
<ItemsControl ItemsSource="{Binding Phases}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:PhaseViewItem">
|
||||
<StackPanel Margin="0,4">
|
||||
<TextBlock><Run Text="{Binding Name}"/><Run Text="{Binding DurationMinutes, StringFormat=' · {0} Min.'}"/></TextBlock>
|
||||
<TextBlock Text="{Binding Activity}" TextWrapping="Wrap" FontSize="12"/>
|
||||
<TextBlock Text="{Binding Material}" TextWrapping="Wrap" FontSize="11"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Expander>
|
||||
|
||||
<!-- Nutzer-Feedback: Hausaufgabe der letzten Stunde ansehen/als kontrolliert abhaken
|
||||
und die Hausaufgabe DIESER Stunde einsehen/ändern, ohne den vollen
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Threading;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Desktop.ViewModels;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -8,7 +12,53 @@ namespace LehrerApp.Desktop.Views.Groups;
|
||||
|
||||
public partial class TeachingModeWindow : Window
|
||||
{
|
||||
public TeachingModeWindow() => InitializeComponent();
|
||||
private static readonly Dictionary<Guid, TeachingModeWindow> OpenWindows = [];
|
||||
private readonly DispatcherTimer _clock = new() { Interval = TimeSpan.FromSeconds(1) };
|
||||
private WindowState _previousState = WindowState.Maximized;
|
||||
|
||||
public static void Open(Lesson lesson)
|
||||
{
|
||||
if (OpenWindows.TryGetValue(lesson.Id, out var existing))
|
||||
{
|
||||
if (existing.WindowState == WindowState.Minimized) existing.WindowState = WindowState.Normal;
|
||||
existing.Activate();
|
||||
return;
|
||||
}
|
||||
var group = App.Services.GetRequiredService<IGroupRepository>().GetById(lesson.GroupId);
|
||||
if (group is null) return;
|
||||
var window = new TeachingModeWindow
|
||||
{
|
||||
DataContext = new TeachingModeViewModel(lesson, group,
|
||||
App.Services.GetRequiredService<IAlternativeLessonPathRepository>(),
|
||||
App.Services.GetRequiredService<ILessonRepository>(),
|
||||
App.Services.GetRequiredService<SeatingPlanTabViewModel>(),
|
||||
App.Services.GetRequiredService<ParticipationTabViewModel>())
|
||||
};
|
||||
OpenWindows.Add(lesson.Id, window);
|
||||
window.Closed += (_, _) => OpenWindows.Remove(lesson.Id);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public TeachingModeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_clock.Tick += (_, _) => (DataContext as TeachingModeViewModel)?.Timeline.Refresh();
|
||||
Opened += (_, _) => _clock.Start();
|
||||
Closed += (_, _) => _clock.Stop();
|
||||
KeyDown += (_, e) =>
|
||||
{
|
||||
if (e.Key == Key.F11) { ToggleFullScreen(); e.Handled = true; }
|
||||
else if (e.Key == Key.Escape && WindowState == WindowState.FullScreen)
|
||||
{ WindowState = _previousState; e.Handled = true; }
|
||||
};
|
||||
}
|
||||
|
||||
private void ToggleFullScreen()
|
||||
{
|
||||
if (WindowState == WindowState.FullScreen) WindowState = _previousState;
|
||||
else { _previousState = WindowState; WindowState = WindowState.FullScreen; }
|
||||
}
|
||||
private void OnFullScreen(object? sender, RoutedEventArgs e) => ToggleFullScreen();
|
||||
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
@@ -35,6 +85,7 @@ public partial class TeachingModeWindow : Window
|
||||
private async Task ShowQuickInputDialog(ParticipationTabViewModel tabVm)
|
||||
{
|
||||
if (tabVm.StudentRows.Count == 0) return;
|
||||
tabVm.RefreshCurrentGrid();
|
||||
var quickVm = new QuickInputViewModel(tabVm.StudentRows.ToList(), tabVm.Aspects.ToList());
|
||||
var dialog = new ParticipationQuickInputDialog { DataContext = quickVm };
|
||||
await dialog.ShowDialog(this);
|
||||
@@ -44,6 +95,7 @@ public partial class TeachingModeWindow : Window
|
||||
private async Task ShowStatusQuickInputDialog(ParticipationTabViewModel tabVm)
|
||||
{
|
||||
if (tabVm.StudentRows.Count == 0 || tabVm.SelectedSession is null) return;
|
||||
tabVm.RefreshCurrentGrid();
|
||||
var quickVm = new AttendanceHomeworkQuickInputViewModel(tabVm.StudentRows, tabVm.SelectedSessionDisplay);
|
||||
var dialog = new AttendanceHomeworkQuickInputDialog { DataContext = quickVm };
|
||||
await dialog.ShowDialog(this);
|
||||
|
||||
@@ -185,19 +185,10 @@ public partial class TimetableView : UserControl
|
||||
await dialog.ShowDialog<bool>(owner);
|
||||
}
|
||||
|
||||
private async Task ShowTeachingMode(Lesson lesson)
|
||||
private Task ShowTeachingMode(Lesson lesson)
|
||||
{
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
var group = App.Services.GetRequiredService<IGroupRepository>().GetById(lesson.GroupId);
|
||||
if (owner is null || group is null) return;
|
||||
|
||||
var teachingModeVm = new TeachingModeViewModel(lesson, group,
|
||||
App.Services.GetRequiredService<IAlternativeLessonPathRepository>(),
|
||||
App.Services.GetRequiredService<ILessonRepository>(),
|
||||
App.Services.GetRequiredService<SeatingPlanTabViewModel>(),
|
||||
App.Services.GetRequiredService<ParticipationTabViewModel>());
|
||||
var window = new TeachingModeWindow { DataContext = teachingModeVm };
|
||||
await window.ShowDialog(owner);
|
||||
TeachingModeWindow.Open(lesson);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task ShowLessonViewerDialog(Lesson lesson)
|
||||
|
||||
Reference in New Issue
Block a user