You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
using AMC.ViewModel.ViewModels;
|
|
|
|
namespace AMC.View.Views
|
|
{
|
|
public partial class LibraryPage : ContentPage
|
|
{
|
|
private readonly LibraryViewModel viewModel;
|
|
|
|
public LibraryPage() : this(null)
|
|
{ }
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Blocker Code Smell", "S3427:Method overloads with default parameter values should not overlap ", Justification = "The parameterless ctor is needed by MAUI")]
|
|
public LibraryPage(LibraryViewModel? libraryViewModel = null)
|
|
{
|
|
InitializeComponent();
|
|
|
|
viewModel = libraryViewModel ?? new LibraryViewModel(null);
|
|
BindingContext = viewModel;
|
|
}
|
|
|
|
private void OnAlbumSelected(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
var collectionView = (CollectionView)sender;
|
|
|
|
if (e.CurrentSelection.FirstOrDefault() is AlbumViewModel selectedAlbum)
|
|
{
|
|
Navigation.PushAsync(new AlbumPage(selectedAlbum));
|
|
}
|
|
|
|
collectionView.SelectedItem = null;
|
|
}
|
|
}
|
|
}
|