From f2659d18ae5bbb1c9f158460eb3c057d30df7401 Mon Sep 17 00:00:00 2001 From: selkij Date: Thu, 18 Sep 2025 09:40:28 +0200 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9C=A8=20Base=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: selkij --- Meio.app/App.axaml | 12 ++- Meio.app/App.axaml.cs | 46 +++++++++ Meio.app/Assets/hamburger_md.svg | 4 + Meio.app/MainWindow.axaml | 27 ------ Meio.app/MainWindow.axaml.cs | 94 ------------------- Meio.app/Meio.app.csproj | 19 ++++ Meio.app/Resources/ColorPalette.axaml | 13 +++ .../Resources/Styles/DarkThemeStyles.axaml | 10 ++ .../Resources/Styles/LightThemeStyles.axaml | 10 ++ Meio.app/Resources/Styles/Styles.axaml | 14 +++ Meio.app/Services/AudioPlayerService.cs | 1 + Meio.app/Views/HomeView.axaml | 8 ++ Meio.app/Views/HomeView.axaml.cs | 11 +++ Meio.app/Views/MainWindow.axaml | 55 +++++++++++ Meio.app/Views/MainWindow.axaml.cs | 54 +++++++++++ Meio.app/Views/SettingsView.axaml | 8 ++ Meio.app/Views/SettingsView.axaml.cs | 11 +++ 17 files changed, 275 insertions(+), 122 deletions(-) create mode 100644 Meio.app/Assets/hamburger_md.svg delete mode 100644 Meio.app/MainWindow.axaml delete mode 100644 Meio.app/MainWindow.axaml.cs create mode 100644 Meio.app/Resources/ColorPalette.axaml create mode 100644 Meio.app/Resources/Styles/DarkThemeStyles.axaml create mode 100644 Meio.app/Resources/Styles/LightThemeStyles.axaml create mode 100644 Meio.app/Resources/Styles/Styles.axaml create mode 100644 Meio.app/Views/HomeView.axaml create mode 100644 Meio.app/Views/HomeView.axaml.cs create mode 100644 Meio.app/Views/MainWindow.axaml create mode 100644 Meio.app/Views/MainWindow.axaml.cs create mode 100644 Meio.app/Views/SettingsView.axaml create mode 100644 Meio.app/Views/SettingsView.axaml.cs diff --git a/Meio.app/App.axaml b/Meio.app/App.axaml index 7bc5830..fd870d2 100644 --- a/Meio.app/App.axaml +++ b/Meio.app/App.axaml @@ -1,10 +1,20 @@ + RequestedThemeVariant="Light"> + + + + + + + + + + \ No newline at end of file diff --git a/Meio.app/App.axaml.cs b/Meio.app/App.axaml.cs index 00e0160..4712652 100644 --- a/Meio.app/App.axaml.cs +++ b/Meio.app/App.axaml.cs @@ -1,6 +1,10 @@ +using System; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using Avalonia.Markup.Xaml.Styling; +using Avalonia.Styling; +using Meio.app.Views; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; using PrettyLogging.Console; @@ -9,6 +13,10 @@ namespace Meio.app; public class App : Application { + private Styles _darkStyle; + private Styles _lightStyle; + private Styles _style; + private static ILoggerFactory? LoggerFactory { get; set; } public static ILogger? Logger { get; private set; } @@ -16,6 +24,44 @@ public class App : Application public override void Initialize() { AvaloniaXamlLoader.Load(this); + + _lightStyle = + [ + new StyleInclude(new Uri("resm:Styles?assembly=Meio.App")) + { + Source = new Uri("avares://Meio.App/Resources/Styles/LightThemeStyles.axaml") + } + ]; + + _darkStyle = + [ + new StyleInclude(new Uri("resm:Styles?assembly=Meio.App")) + { + Source = new Uri("avares://Meio.App/Resources/Styles/DarkThemeStyles.axaml") + } + ]; + + _style = + [ + new StyleInclude(new Uri("resm:Styles?assembly=Meio.App")) + { + Source = new Uri("avares://Meio.App/Resources/Styles/Styles.axaml") + } + ]; + } + + public void SwitchToLight() + { + Styles.Clear(); + Styles.Add(_style); + Styles.Add(_lightStyle); + } + + public void SwitchToDark() + { + Styles.Clear(); + Styles.Add(_style); + Styles.Add(_darkStyle); } public override void OnFrameworkInitializationCompleted() diff --git a/Meio.app/Assets/hamburger_md.svg b/Meio.app/Assets/hamburger_md.svg new file mode 100644 index 0000000..cc99394 --- /dev/null +++ b/Meio.app/Assets/hamburger_md.svg @@ -0,0 +1,4 @@ + + + diff --git a/Meio.app/MainWindow.axaml b/Meio.app/MainWindow.axaml deleted file mode 100644 index 7f6c48b..0000000 --- a/Meio.app/MainWindow.axaml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - Currently reading - - - - -