using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using OwlCore.Extensions;
using StrixMusic.Sdk.ViewModels;
using StrixMusic.Shells.Groove.Messages.Navigation.Pages;
using StrixMusic.Shells.Groove.ViewModels.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace StrixMusic.Shells.Groove.Controls.Collections
{
///
/// A for displaying s in the Groove Shell.
///
public partial class GrooveAlbumCollection : Control
{
///
/// Initializes a new instance of the class.
///
public GrooveAlbumCollection()
{
DefaultStyleKey = typeof(GrooveAlbumCollection);
NavigateToAlbumCommand = new RelayCommand(NavigateToAlbum);
}
///
/// A Command that requests a navigation to an album page.
///
public RelayCommand NavigateToAlbumCommand { get; private set; }
///
/// The album collection to display.
///
public IAlbumCollectionViewModel? AlbumCollection
{
get => (IAlbumCollectionViewModel)GetValue(AlbumCollectionProperty);
set => SetValue(AlbumCollectionProperty, value);
}
///
/// The backing dependency property for .
///
public static readonly DependencyProperty AlbumCollectionProperty =
DependencyProperty.Register(nameof(AlbumCollection), typeof(IAlbumCollectionViewModel), typeof(GrooveAlbumCollection), new PropertyMetadata(null, (d, e) => d.Cast().OnAlbumCollectionChanged()));
private void OnAlbumCollectionChanged()
{
}
private void NavigateToAlbum(AlbumViewModel? viewModel)
{
if (viewModel != null)
WeakReferenceMessenger.Default.Send(new AlbumViewNavigationRequestMessage(viewModel));
}
}
}