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 @@ + + + + + + + + + + +