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.
44 lines
1.3 KiB
44 lines
1.3 KiB
using ToolKit;
|
|
using System.Windows.Input;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace BookApp.ViewModel
|
|
{
|
|
public class NavigationViewModel : BaseViewModel
|
|
{
|
|
public NavigationViewModel() { }
|
|
|
|
private async void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (e.CurrentSelection.FirstOrDefault() is ViewModelMenu selectedItem)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(selectedItem.Route))
|
|
{
|
|
Type pageType = Type.GetType("BookApp.Pages." + selectedItem.Route);
|
|
if (pageType == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Page pageInstance = (Page)Activator.CreateInstance(pageType);
|
|
// await Navigation.PushAsync(pageInstance);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Erreur trouvé");
|
|
}
|
|
}
|
|
}
|
|
|
|
async void ButtonTous(object sender, EventArgs args)
|
|
{
|
|
await Shell.Current.GoToAsync("TousPage");
|
|
}
|
|
|
|
async void ButtonAuteur(object sender, EventArgs args)
|
|
{
|
|
await Shell.Current.GoToAsync("FiltragePage");
|
|
}
|
|
}
|
|
}
|