using System.Collections.ObjectModel; using System.Reactive.Disposables; using System.Reactive.Linq; using ReactiveUI; using ReactiveUI.SourceGenerators; using Splat; using StarsAssistant.Model; namespace StarsAssistant.ViewModels; public partial class MainWindowViewModel : ViewModelBase, IActivatableViewModel { public ViewModelActivator Activator { get; } = new ViewModelActivator(); [ObservableAsProperty] private string _dbPath = ""; public MainWindowViewModel() { using var db = Locator.Current.GetService()!; _dbPathHelper = Observable.Return(Path.GetFullPath(db.DbPath)) .ToProperty(this, x => x.DbPath); this.WhenActivated((CompositeDisposable disposables) => { // /* handle activation */ // Disposable // .Create(() => { /* handle deactivation */ }) // .DisposeWith(disposables); }); } public ObservableCollection Planets { get; } = PlanetViewModel.LoadAll(); }