33 lines
946 B
C#
33 lines
946 B
C#
using System.Collections.ObjectModel;
|
|
using System.Reactive.Disposables;
|
|
using System.Reactive.Linq;
|
|
using DynamicData;
|
|
using ReactiveUI;
|
|
using ReactiveUI.SourceGenerators;
|
|
using Splat;
|
|
using StarsAssistant.Model;
|
|
using StarsAssistant.Services;
|
|
|
|
namespace StarsAssistant.ViewModels;
|
|
|
|
public partial class BuColViewModel : ViewModelBase
|
|
{
|
|
private readonly ReadOnlyObservableCollection<PlayerPlanetViewModel> _playerPlanetsView;
|
|
public ReadOnlyObservableCollection<PlayerPlanetViewModel> PlayerPlanets => _playerPlanetsView;
|
|
|
|
[Reactive]
|
|
private PlayerPlanetViewModel? _selectedPlanet;
|
|
|
|
public BuColViewModel()
|
|
{
|
|
var planetManager = Locator.Current.GetService<PlanetManager>()!;
|
|
|
|
planetManager.PlayerPlanetsSource
|
|
.ObserveOn(RxApp.MainThreadScheduler)
|
|
.Bind(out _playerPlanetsView)
|
|
.DisposeMany()
|
|
.Subscribe();
|
|
|
|
}
|
|
}
|