sa/Stars Assistant/ViewModels/MainWindowViewModel.cs

34 lines
1.0 KiB
C#

using System.Collections.ObjectModel;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
using ReactiveUI.SourceGenerators;
namespace StarsAssistant.ViewModels;
public partial class MainWindowViewModel : ViewModelBase, IActivatableViewModel
{
public ViewModelActivator Activator { get; } = new ViewModelActivator();
[ObservableAsProperty]
private string _welcomeMessage;
public MainWindowViewModel()
{
_welcomeMessage = "Lorem Ipsum";
_welcomeMessageHelper = Observable.Return("Dolor sit amet")
.ToProperty(this, x => x.WelcomeMessage);
this.WhenActivated((CompositeDisposable disposables) =>
{
// /* handle activation */
// Disposable
// .Create(() => { /* handle deactivation */ })
// .DisposeWith(disposables);
});
}
public ObservableCollection<PlanetViewModel> Planets { get; } = PlanetViewModel.LoadAll();
}