sa/Stars Assistant/ViewModels/BuColViewModel.cs

33 lines
946 B
C#
Raw Normal View History

2024-09-22 20:12:46 +00:00
using System.Collections.ObjectModel;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using DynamicData;
2024-09-22 20:12:46 +00:00
using ReactiveUI;
using ReactiveUI.SourceGenerators;
using Splat;
using StarsAssistant.Model;
using StarsAssistant.Services;
2024-09-22 20:12:46 +00:00
namespace StarsAssistant.ViewModels;
2024-09-23 20:40:18 +00:00
public partial class BuColViewModel : ViewModelBase
2024-09-22 20:12:46 +00:00
{
private readonly ReadOnlyObservableCollection<PlayerPlanetViewModel> _playerPlanetsView;
public ReadOnlyObservableCollection<PlayerPlanetViewModel> PlayerPlanets => _playerPlanetsView;
[Reactive]
private PlayerPlanetViewModel? _selectedPlanet;
2024-09-22 20:12:46 +00:00
public BuColViewModel()
{
var planetManager = Locator.Current.GetService<PlanetManager>()!;
planetManager.PlayerPlanetsSource
.ObserveOn(RxApp.MainThreadScheduler)
.Bind(out _playerPlanetsView)
.DisposeMany()
.Subscribe();
}
2024-09-22 20:12:46 +00:00
}