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.
LivreLand/LivreLand/ViewModel/FavorisVM.cs

50 lines
1.2 KiB

using LivreLand.View;
using PersonalMVVMToolkit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels;
namespace LivreLand.ViewModel
{
public class FavorisVM : BaseViewModel
{
#region Properties
public NavigatorVM Navigator { get; private set; }
public ManagerVM Manager { get; private set; }
public ICommand OnSelectionChangedCommand { get; private set; }
#endregion
#region Constructor
public FavorisVM(NavigatorVM navigatorVM, ManagerVM managerVM)
{
Navigator = navigatorVM;
Manager = managerVM;
OnSelectionChangedCommand = new RelayCommand<BookVM>((bookVM) => OnSelectionChanged(bookVM));
}
#endregion
#region Methods
private void OnSelectionChanged(BookVM bookVM)
{
if (bookVM != null)
{
var result = new DetailsLivreVM(Manager, Navigator, bookVM);
App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView(result));
}
}
#endregion
}
}