sa/Stars Assistant/ViewModels/MainWindowViewModel.cs

36 lines
959 B
C#

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<StarsDatabase>()!;
_dbPathHelper = Observable.Return(Path.GetFullPath(db.DbPath))
.ToProperty(this, x => x.DbPath);
this.WhenActivated((CompositeDisposable disposables) =>
{
// /* handle activation */
// Disposable
// .Create(() => { /* handle deactivation */ })
// .DisposeWith(disposables);
});
}
}