From e28b2431009878a18c3e83065068545d70447493 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Tue, 14 Apr 2026 13:15:44 +0200 Subject: [PATCH] launcher: scaffold avalonia main window, view models, and settings dialog Adds the Avalonia App, MainWindow (900x560 fixed, dark-red banner, left status/progress column, right news panel) and a modal SettingsDialog with language + dev-mode override. MainWindowViewModel binds to the orchestrator through IProgress, throttles UI updates to ~10 Hz via a DispatcherTimer flush, drives state-specific status text and Play-button gating, fetches previous-manifest notes best-effort, and forces a red status banner with Play disabled on a SignatureFailed result. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Metin2Launcher/UI/App.axaml | 8 + src/Metin2Launcher/UI/App.axaml.cs | 28 ++ src/Metin2Launcher/UI/MainWindow.axaml | 104 +++++++ src/Metin2Launcher/UI/MainWindow.axaml.cs | 17 ++ src/Metin2Launcher/UI/SettingsDialog.axaml | 40 +++ src/Metin2Launcher/UI/SettingsDialog.axaml.cs | 27 ++ .../UI/ViewModels/MainWindowViewModel.cs | 274 ++++++++++++++++++ .../UI/ViewModels/SettingsDialogViewModel.cs | 50 ++++ 8 files changed, 548 insertions(+) create mode 100644 src/Metin2Launcher/UI/App.axaml create mode 100644 src/Metin2Launcher/UI/App.axaml.cs create mode 100644 src/Metin2Launcher/UI/MainWindow.axaml create mode 100644 src/Metin2Launcher/UI/MainWindow.axaml.cs create mode 100644 src/Metin2Launcher/UI/SettingsDialog.axaml create mode 100644 src/Metin2Launcher/UI/SettingsDialog.axaml.cs create mode 100644 src/Metin2Launcher/UI/ViewModels/MainWindowViewModel.cs create mode 100644 src/Metin2Launcher/UI/ViewModels/SettingsDialogViewModel.cs diff --git a/src/Metin2Launcher/UI/App.axaml b/src/Metin2Launcher/UI/App.axaml new file mode 100644 index 0000000..48b44fe --- /dev/null +++ b/src/Metin2Launcher/UI/App.axaml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/Metin2Launcher/UI/App.axaml.cs b/src/Metin2Launcher/UI/App.axaml.cs new file mode 100644 index 0000000..5fde887 --- /dev/null +++ b/src/Metin2Launcher/UI/App.axaml.cs @@ -0,0 +1,28 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using Metin2Launcher.UI.ViewModels; + +namespace Metin2Launcher.UI; + +public partial class App : Application +{ + public static MainWindowViewModel? MainViewModel { get; set; } + + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + var vm = MainViewModel ?? new MainWindowViewModel(); + desktop.MainWindow = new MainWindow { DataContext = vm }; + vm.AttachWindow(desktop.MainWindow); + desktop.MainWindow.Opened += async (_, _) => await vm.StartUpdateAsync(); + } + base.OnFrameworkInitializationCompleted(); + } +} diff --git a/src/Metin2Launcher/UI/MainWindow.axaml b/src/Metin2Launcher/UI/MainWindow.axaml new file mode 100644 index 0000000..863927e --- /dev/null +++ b/src/Metin2Launcher/UI/MainWindow.axaml @@ -0,0 +1,104 @@ + + + + + + + + + + +