diff --git a/src/XIVLauncher2/App.axaml.cs b/src/XIVLauncher2/App.axaml.cs index 737fffb..3b4e5e5 100644 --- a/src/XIVLauncher2/App.axaml.cs +++ b/src/XIVLauncher2/App.axaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using XIVLauncher2.ViewModels; namespace XIVLauncher2; @@ -15,7 +16,10 @@ public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - desktop.MainWindow = new MainWindow(); + desktop.MainWindow = new MainWindow() + { + DataContext = new MainWindowViewModel() + }; } base.OnFrameworkInitializationCompleted(); diff --git a/src/XIVLauncher2/ViewModels/MainWindowViewModel.cs b/src/XIVLauncher2/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..340534d --- /dev/null +++ b/src/XIVLauncher2/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,17 @@ +using System.Reactive; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; + +namespace XIVLauncher2.ViewModels; + +public partial class MainWindowViewModel : ViewModelBase +{ + [ObservableProperty] + private string _XIVLauncherText = "XIVLauncher"; + + [RelayCommand] + private void RunTheThing() + { + this.XIVLauncherText = "XIVLauncher TWO"; + } +} diff --git a/src/XIVLauncher2/ViewModels/ViewModelBase.cs b/src/XIVLauncher2/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..76268fd --- /dev/null +++ b/src/XIVLauncher2/ViewModels/ViewModelBase.cs @@ -0,0 +1,5 @@ +namespace XIVLauncher2.ViewModels; + +using CommunityToolkit.Mvvm.ComponentModel; + +public class ViewModelBase : ObservableObject { } diff --git a/src/XIVLauncher2/MainWindow.axaml b/src/XIVLauncher2/Views/MainWindow.axaml similarity index 85% rename from src/XIVLauncher2/MainWindow.axaml rename to src/XIVLauncher2/Views/MainWindow.axaml index 61e0e06..d276910 100644 --- a/src/XIVLauncher2/MainWindow.axaml +++ b/src/XIVLauncher2/Views/MainWindow.axaml @@ -3,17 +3,20 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" + xmlns:vm="using:XIVLauncher2.ViewModels" mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="500" x:Class="XIVLauncher2.MainWindow" Title="XIVLauncher2" Width="1000" Height="500" MinWidth="1000" MinHeight="500" - MaxWidth="1280" MaxHeight="800" WindowStartupLocation="CenterScreen" TransparencyLevelHint="AcrylicBlur" Background="Transparent" ExtendClientAreaToDecorationsHint="False"> - + + + + - - + + @@ -65,9 +68,12 @@ -