Files
LehrerApp/LehrerApp.Desktop/Views/MainWindow.axaml
T
adminandClaude Sonnet 5 db1afff7e4 Fehlerbehandlung, Logging und feldbezogene Validierung (Kapitel 13.2)
Zentrale Exception-Behandlung (Dispatcher.UIThread.UnhandledException,
AppDomain, TaskScheduler) verhindert Abstürze und protokolliert Fehler
über AppLogger in eine rotierende Log-Datei im App-Datenverzeichnis.
Toast-Benachrichtigungen zeigen Erfolg/Fehler global an. Alle Dialoge
mit Formularfeldern zeigen Validierungsmeldungen jetzt direkt am
betroffenen Feld statt in einem Sammel-Label.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 12:38:30 +02:00

223 lines
10 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
xmlns:vmg="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
xmlns:vms="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
xmlns:views="clr-namespace:LehrerApp.Desktop.Views"
xmlns:vd="clr-namespace:LehrerApp.Desktop.Views.Dashboard"
xmlns:vg="clr-namespace:LehrerApp.Desktop.Views.Groups"
xmlns:vs="clr-namespace:LehrerApp.Desktop.Views.Students"
xmlns:vset="clr-namespace:LehrerApp.Desktop.Views.Settings"
xmlns:vmset="clr-namespace:LehrerApp.Desktop.ViewModels.Settings"
xmlns:svc="clr-namespace:LehrerApp.Desktop.Services"
x:Class="LehrerApp.Desktop.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Title="LehrerApp"
Width="1280" Height="800"
MinWidth="900" MinHeight="600">
<Panel>
<!--
Avalonia 12: DrawerPage ersetzt die selbstgebaute Sidebar.
DrawerBreakpointWidth="900" → Sidebar ab 900px dauerhaft sichtbar,
darunter als Overlay-Drawer mit Hamburger-Button (automatisch).
Kein eigener Code nötig.
-->
<DrawerPage x:Name="RootDrawer"
DrawerLength="220"
DrawerBehavior="Auto"
DrawerLayoutBehavior="CompactInline"
Content="{Binding CurrentPage}">
<DrawerPage.DataTemplates>
<DataTemplate DataType="vm:DashboardViewModel">
<vd:DashboardView/>
</DataTemplate>
<DataTemplate DataType="vmg:GroupListViewModel">
<vg:GroupListView/>
</DataTemplate>
<DataTemplate DataType="vmg:GroupDetailViewModel">
<vg:GroupDetailView/>
</DataTemplate>
<DataTemplate DataType="vms:StudentListViewModel">
<vs:StudentListView/>
</DataTemplate>
<DataTemplate DataType="vms:StudentDetailViewModel">
<vs:StudentDetailView/>
</DataTemplate>
<DataTemplate DataType="vmset:SettingsViewModel">
<vset:SettingsView/>
</DataTemplate>
<DataTemplate DataType="vm:PlaceholderViewModel">
<views:PlaceholderView/>
</DataTemplate>
</DrawerPage.DataTemplates>
<DrawerPage.Drawer>
<DockPanel Classes.compact="{Binding !#RootDrawer.IsOpen}">
<DockPanel.Styles>
<!-- Basisgröße der Icons als Style (nicht lokal), damit der Compact-Selector sie
überschreiben kann lokale Werte hätten immer Vorrang vor Style-Settern. -->
<Style Selector="TextBlock.navicon">
<Setter Property="FontSize" Value="15"/>
</Style>
<!-- Minimierter Zustand: Icons größer & zentriert, Beschriftungen ausgeblendet -->
<Style Selector="DockPanel.compact TextBlock.navlabel">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="DockPanel.compact TextBlock.navicon">
<Setter Property="FontSize" Value="20"/>
</Style>
<Style Selector="DockPanel.compact Button.navitem">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style Selector="DockPanel.compact TextBlock.navsection">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="DockPanel.compact TextBlock.appsubtitle">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="DockPanel.compact Border.appheader">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DockPanel.Styles>
<Border DockPanel.Dock="Top" Padding="16,20,16,14"
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
BorderThickness="0,0,0,1">
<StackPanel Orientation="Horizontal" Spacing="10">
<Border Classes="appheader" Width="32" Height="32" CornerRadius="8"
Background="{DynamicResource SystemControlBackgroundAccentBrush}">
<TextBlock Text="L" FontSize="16" FontWeight="Bold" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Classes="appsubtitle" VerticalAlignment="Center">
<TextBlock Text="LehrerApp" FontSize="15" FontWeight="SemiBold"/>
<TextBlock Text="{Binding CurrentSchoolYear}"
FontSize="11" Opacity="0.55"/>
</StackPanel>
</StackPanel>
</Border>
<Border DockPanel.Dock="Bottom" Padding="12,8"
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
BorderThickness="0,1,0,0">
<views:SyncStatusBar DataContext="{Binding SyncStatus}"/>
</Border>
<ScrollViewer>
<StackPanel Margin="8,12,8,0" Spacing="2">
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Dashboard}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="📊" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Dashboard"/>
</StackPanel>
</Button>
<TextBlock Classes="navsection" Text="UNTERRICHT" FontSize="10" FontWeight="Bold"
Opacity="0.4" Margin="10,14,0,4"/>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Groups}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="🏫" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Lerngruppen"/>
</StackPanel>
</Button>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Students}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="👤" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Schüler"/>
</StackPanel>
</Button>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Exams}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="📝" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Klausuren"/>
</StackPanel>
</Button>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Planner}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="📅" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Planung"/>
</StackPanel>
</Button>
<TextBlock Classes="navsection" Text="VERWALTUNG" FontSize="10" FontWeight="Bold"
Opacity="0.4" Margin="10,14,0,4"/>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Workload}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="⏱" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Arbeitszeit"/>
</StackPanel>
</Button>
<Button Classes="navitem" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left" Background="Transparent"
Padding="10,8" CornerRadius="6"
Command="{Binding NavigateToCommand}"
CommandParameter="{x:Static vm:NavItem.Settings}">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Classes="navicon" Text="⚙️" Width="20" TextAlignment="Center"/>
<TextBlock Classes="navlabel" Text="Einstellungen"/>
</StackPanel>
</Button>
</StackPanel>
</ScrollViewer>
</DockPanel>
</DrawerPage.Drawer>
</DrawerPage>
<!-- Toast-Benachrichtigungen (13.2.3): schweben über der aktuellen Seite, unten rechts. -->
<ItemsControl ItemsSource="{Binding Toasts}"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Margin="0,0,20,20" IsHitTestVisible="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Spacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Styles>
<Style Selector="Border.toast">
<Setter Property="Background" Value="#323232"/>
</Style>
<Style Selector="Border.toast.error">
<Setter Property="Background" Value="#B3261E"/>
</Style>
</ItemsControl.Styles>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="svc:ToastItem">
<Border Classes="toast" Classes.error="{Binding IsError}"
CornerRadius="8" Padding="14,10" MaxWidth="360">
<TextBlock Text="{Binding Message}" Foreground="White" FontSize="13" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Panel>
</Window>