Move to ReactiveUI

This commit is contained in:
Torben Nehmer 2024-09-13 21:09:33 +02:00
parent fa82a4fbb3
commit 17f890cb9f
2 changed files with 8 additions and 7 deletions

View File

@ -1,12 +1,11 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using ReactiveUI;
namespace StarsAssistant.ViewModels; namespace StarsAssistant.ViewModels;
public partial class MainWindowViewModel : ViewModelBase public partial class MainWindowViewModel : ViewModelBase, IActivatableViewModel
{ {
#pragma warning disable CA1822 // Mark members as static public ViewModelActivator Activator { get; } = new ViewModelActivator();
public string Greeting => "Welcome to Stars Assistant!";
#pragma warning restore CA1822 // Mark members as static
public ObservableCollection<PlanetViewModel> Planets { get; } = PlanetViewModel.LoadAll(); public ObservableCollection<PlanetViewModel> Planets { get; } = PlanetViewModel.LoadAll();

View File

@ -1,14 +1,16 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.ReactiveUI;
using System.Diagnostics; using System.Diagnostics;
using System; using System;
using StarsAssistant.ViewModels;
using Avalonia.Markup.Xaml;
namespace StarsAssistant.Views; namespace StarsAssistant.Views;
public partial class MainWindow : Window public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
{ {
public MainWindow() public MainWindow()
{ {
InitializeComponent(); AvaloniaXamlLoader.Load(this);
} }
} }