using System;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using StrixMusic.Sdk.ViewModels;
using StrixMusic.Sdk.WinUI.Controls.Items;
using StrixMusic.Shells.Groove.Messages.Navigation.Pages;
namespace StrixMusic.Shells.Groove.Controls.Items
{
///
public class GrooveTrackItem : TrackItem
{
///
public GrooveTrackItem()
{
this.DefaultStyleKey = typeof(GrooveTrackItem);
NavigateToAlbumCommand = new RelayCommand(new Action(NavigateToAlbum));
}
///
/// A command that triggers navigation to the provided track's album.
///
public RelayCommand NavigateToAlbumCommand { get; private set; }
private void NavigateToAlbum(TrackViewModel? viewModel)
{
if (viewModel != null && viewModel.Album != null)
WeakReferenceMessenger.Default.Send(new AlbumViewNavigationRequestMessage(viewModel.Album));
}
}
}