using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; using StrixMusic.Sdk.ViewModels; using StrixMusic.Shells.Groove.Messages.Navigation.Pages; namespace StrixMusic.Shells.Groove.ViewModels.Collections { /// /// A ViewModel for a . /// public class GrooveAlbumCollectionViewModel : ObservableObject { private IAlbumCollectionViewModel? _albumCollectionViewModel; /// /// Initializes a new instance of the class. /// public GrooveAlbumCollectionViewModel() { NavigateToAlbumCommand = new RelayCommand(NavigateToAlbum); } /// /// Initializes a new instance of the class. /// public GrooveAlbumCollectionViewModel(IAlbumCollectionViewModel viewModel) : this() { AlbumCollection = viewModel; } /// /// The inside this ViewModel on display. /// public IAlbumCollectionViewModel? AlbumCollection { get => _albumCollectionViewModel; set => SetProperty(ref _albumCollectionViewModel, value); } /// /// A Command that requests a navigation to an album page. /// public RelayCommand NavigateToAlbumCommand { get; private set; } private void NavigateToAlbum(AlbumViewModel? viewModel) { if (viewModel != null) WeakReferenceMessenger.Default.Send(new AlbumViewNavigationRequestMessage(viewModel)); } } }