From f321e28473f617e4ece06f9fb42ca5c12630bb24 Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Thu, 27 Feb 2025 18:55:49 +0100 Subject: [PATCH] [fix:] fixed several issues and improved performance as well as ux --- App.axaml | 13 ++--- App.axaml.cs | 9 ++++ MainWindow.axaml | 21 ++++---- MainWindow.axaml.cs | 70 +++++++++++++++++++++++++-- MessageBox.axaml.cs | 6 +-- ThemeManager.cs | 16 ++++++ obj/PLG-Exam.csproj.nuget.dgspec.json | 2 + obj/project.assets.json | 18 ++++--- obj/project.nuget.cache | 2 +- 9 files changed, 122 insertions(+), 35 deletions(-) create mode 100644 ThemeManager.cs diff --git a/App.axaml b/App.axaml index f1e306f..6e26636 100644 --- a/App.axaml +++ b/App.axaml @@ -1,14 +1,11 @@ + RequestedThemeVariant="Light"> - - - - - 10 - 1000 - + + + + \ No newline at end of file diff --git a/App.axaml.cs b/App.axaml.cs index 613c6f1..7c0efdf 100644 --- a/App.axaml.cs +++ b/App.axaml.cs @@ -1,6 +1,8 @@ using Avalonia; +using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using Avalonia.Styling; namespace PLG_Exam; @@ -11,6 +13,13 @@ public partial class App : Application AvaloniaXamlLoader.Load(this); } + public void ToggleTheme() + { + RequestedThemeVariant = RequestedThemeVariant == ThemeVariant.Dark + ? ThemeVariant.Light + : ThemeVariant.Dark; + } + public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) diff --git a/MainWindow.axaml b/MainWindow.axaml index 9a88d35..d21106b 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -7,9 +7,9 @@ Title="PLG Exam"> - + - +